diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-10-20 21:52:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-20 09:52:10 -0400 |
commit | dfe19c5c7570c650e25617f6653bb103ad89e4d5 (patch) | |
tree | 90638613f0152c842f36e0b7c68e5d8d1607b98d /cli/dts | |
parent | 070d99645f4849cfc4479382d756bd40379594d0 (diff) |
feat: stabilize Deno.fsync and Deno.fdatasync (#8038)
Diffstat (limited to 'cli/dts')
-rw-r--r-- | cli/dts/lib.deno.ns.d.ts | 46 | ||||
-rw-r--r-- | cli/dts/lib.deno.unstable.d.ts | 46 |
2 files changed, 46 insertions, 46 deletions
diff --git a/cli/dts/lib.deno.ns.d.ts b/cli/dts/lib.deno.ns.d.ts index 276f13e37..896b5c800 100644 --- a/cli/dts/lib.deno.ns.d.ts +++ b/cli/dts/lib.deno.ns.d.ts @@ -676,6 +676,52 @@ declare namespace Deno { whence: SeekMode, ): Promise<number>; + /** + * 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; + + /** + * 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>; + + /* + * Synchronously flushes any pending data 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.fdatasyncSync(file.rid); + * console.log(new TextDecoder().decode(Deno.readFileSync("my_file.txt"))); // Hello World + * ``` + */ + export function fdatasyncSync(rid: number): void; + + /** + * Flushes any pending data 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.fdatasync(file.rid); + * console.log(new TextDecoder().decode(await Deno.readFile("my_file.txt"))); // Hello World + * ``` + */ + export function fdatasync(rid: number): Promise<void>; + /** Close the given resource ID (rid) which has been previously opened, such * as via opening or creating a file. Closing a file when you are finished * with it is important to avoid leaking resources. diff --git a/cli/dts/lib.deno.unstable.d.ts b/cli/dts/lib.deno.unstable.d.ts index 4269d4b74..1c1869827 100644 --- a/cli/dts/lib.deno.unstable.d.ts +++ b/cli/dts/lib.deno.unstable.d.ts @@ -1170,52 +1170,6 @@ declare namespace Deno { */ export function ftruncate(rid: number, len?: number): Promise<void>; - /* **UNSTABLE**: New API, yet to be vetted. - * Synchronously flushes any pending data 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.fdatasyncSync(file.rid); - * console.log(new TextDecoder().decode(Deno.readFileSync("my_file.txt"))); // Hello World - * ``` - */ - export function fdatasyncSync(rid: number): void; - - /** **UNSTABLE**: New API, yet to be vetted. - * Flushes any pending data 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.fdatasync(file.rid); - * console.log(new TextDecoder().decode(await Deno.readFile("my_file.txt"))); // Hello World - * ``` - */ - export function fdatasync(rid: 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>; - /** **UNSTABLE**: New API, yet to be vetted. * Synchronously returns a `Deno.FileInfo` for the given file stream. * |