diff options
Diffstat (limited to 'cli/js/lib.deno.unstable.d.ts')
-rw-r--r-- | cli/js/lib.deno.unstable.d.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/cli/js/lib.deno.unstable.d.ts b/cli/js/lib.deno.unstable.d.ts index 3339bfbac..daecf6604 100644 --- a/cli/js/lib.deno.unstable.d.ts +++ b/cli/js/lib.deno.unstable.d.ts @@ -1118,4 +1118,28 @@ declare namespace Deno { * ``` */ export function ftruncate(rid: number, len?: number): Promise<void>; + + /** **UNSTABLE**: New API, yet to be vetted. + * Synchronously flushes any pending data and metadata operations of the given file stream to disk. + * ```ts + * const file = Deno.openSync("my_file.txt", { read: true, write: true, create: true }); + * Deno.writeSync(file.rid, new TextEncoder().encode("Hello World")); + * Deno.ftruncateSync(file.rid, 1); + * Deno.fsyncSync(file.rid); + * console.log(new TextDecoder().decode(Deno.readFileSync("my_file.txt"))); // H + * ``` + */ + export function fsyncSync(rid: number): void; + + /** **UNSTABLE**: New API, yet to be vetted. + * Flushes any pending data and metadata operations of the given file stream to disk. + * ```ts + * const file = await Deno.open("my_file.txt", { read: true, write: true, create: true }); + * await Deno.write(file.rid, new TextEncoder().encode("Hello World")); + * await Deno.ftruncate(file.rid, 1); + * await Deno.fsync(file.rid); + * console.log(new TextDecoder().decode(await Deno.readFile("my_file.txt"))); // H + * ``` + */ + export function fsync(rid: number): Promise<void>; } |