fix types

This commit is contained in:
Philipinho
2024-03-25 02:19:28 +00:00
parent df6b0326ba
commit cacb5606b1
5 changed files with 18 additions and 18 deletions

View File

@ -20,24 +20,24 @@ export class LocalDriver implements StorageDriver {
async upload(filePath: string, file: Buffer): Promise<void> {
try {
await fs.outputFile(this._fullPath(filePath), file);
} catch (error) {
throw new Error(`Failed to upload file: ${error.message}`);
} catch (err) {
throw new Error(`Failed to upload file: ${(err as Error).message}`);
}
}
async read(filePath: string): Promise<Buffer> {
try {
return await fs.readFile(this._fullPath(filePath));
} catch (error) {
throw new Error(`Failed to read file: ${error.message}`);
} catch (err) {
throw new Error(`Failed to read file: ${(err as Error).message}`);
}
}
async exists(filePath: string): Promise<boolean> {
try {
return await fs.pathExists(this._fullPath(filePath));
} catch (error) {
throw new Error(`Failed to check file existence: ${error.message}`);
} catch (err) {
throw new Error(`Failed to check file existence: ${(err as Error).message}`);
}
}
@ -52,8 +52,8 @@ export class LocalDriver implements StorageDriver {
async delete(filePath: string): Promise<void> {
try {
await fs.remove(this._fullPath(filePath));
} catch (error) {
throw new Error(`Failed to delete file: ${error.message}`);
} catch (err) {
throw new Error(`Failed to delete file: ${(err as Error).message}`);
}
}