mirror of
https://github.com/denoland/deno.git
synced 2025-09-28 05:04:48 +00:00
feat(unstable): add Deno.fdatasyncSync and fdatasync (#6403)
This commit is contained in:
parent
ed0b1d4627
commit
e278c90d8a
5 changed files with 112 additions and 1 deletions
22
cli/js/lib.deno.unstable.d.ts
vendored
22
cli/js/lib.deno.unstable.d.ts
vendored
|
@ -1119,6 +1119,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 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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue