0
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2025-02-08 07:16:56 -05:00

Add sync method to filehandle method

This commit is contained in:
张瑞 2024-11-25 17:05:38 +08:00
parent 6b7e4c331b
commit 43ac6b9573
2 changed files with 5 additions and 0 deletions

View file

@ -148,6 +148,10 @@ export class FileHandle extends EventEmitter {
stat(options: { bigint: true }): Promise<BigIntStats>;
stat(options?: { bigint: boolean }): Promise<Stats | BigIntStats> {
return fsCall(promises.fstat, this, options);
};
// readLines(options?):Promise<InterfaceConstructor>
sync():Promise<void>{
return Promise.resolve(promises.sync());
}
}

View file

@ -70,6 +70,7 @@ Deno.test("[node/fs filehandle.write] Write from Buffer", async function () {
const buffer = Buffer.from("hello world");
const res = await fileHandle.write(buffer, 0, 5, 0);
await fileHandle.sync();
const data = Deno.readFileSync(tempFile);
await Deno.remove(tempFile);