Skip to main content
Deno.FsFile.prototype.syncDataSync - Deno documentation
method Deno.FsFile.prototype.syncDataSync
FsFile.prototype.syncDataSync(): void

Synchronously flushes any pending data operations of the given file stream to disk.

using file = Deno.openSync(
 "my_file.txt",
 { read: true, write: true, create: true },
);
file.writeSync(new TextEncoder().encode("Hello World"));
file.syncDataSync();
console.log(Deno.readTextFileSync("my_file.txt")); // Hello World

Return Type

void
Back to top