We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 49d0651 + fd112dc commit 71d6aa1Copy full SHA for 71d6aa1
1 file changed
sdk/typescript/src/filesystem.ts
@@ -349,7 +349,15 @@ export class Filesystem {
349
await updateStmt.run(buffer.length, now, ino);
350
}
351
352
- async readFile(path: string, encoding?: BufferEncoding): Promise<Buffer | string> {
+ async readFile(
353
+ path: string,
354
+ options?: BufferEncoding | { encoding?: BufferEncoding }
355
+ ): Promise<Buffer | string> {
356
+ // Normalize options
357
+ const encoding = typeof options === 'string'
358
+ ? options
359
+ : options?.encoding;
360
+
361
const ino = await this.resolvePath(path);
362
if (ino === null) {
363
throw new Error(`ENOENT: no such file or directory, open '${path}'`);
0 commit comments