File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ import type {
66 ObjectDownloadURLView ,
77 ObjectListParams ,
88} from '../resources/objects' ;
9- import * as fs from 'node:fs' ;
9+ import * as fs from 'node:fs/promises ' ;
1010import * as path from 'node:path' ;
1111
1212// Extract the content type from the API types
@@ -293,7 +293,7 @@ export class StorageObject {
293293
294294 // Check if file exists and get stats
295295 try {
296- const stats = fs . statSync ( filePath ) ;
296+ const stats = await fs . stat ( filePath ) ;
297297 if ( ! stats . isFile ( ) ) {
298298 throw new Error ( `Path is not a file: ${ filePath } ` ) ;
299299 }
@@ -306,7 +306,7 @@ export class StorageObject {
306306 // Read file content immediately to fail fast if file doesn't exist
307307 let fileBuffer : Buffer ;
308308 try {
309- fileBuffer = fs . readFileSync ( filePath ) ;
309+ fileBuffer = await fs . readFile ( filePath ) ;
310310 } catch ( error ) {
311311 throw new Error (
312312 `Failed to read file ${ filePath } : ${ error instanceof Error ? error . message : 'Unknown error' } ` ,
You can’t perform that action at this time.
0 commit comments