Skip to main content

writeSync

method Deno.FsFile.prototype.writeSync
Jump to headingFsFile.prototype.writeSync(p: Uint8Array): number

Synchronously write the contents of the array buffer (p) to the file.

Returns the number of bytes written.

It is not guaranteed that the full buffer will be written in a single call.

const encoder = new TextEncoder();
const data = encoder.encode("Hello world");
using file = Deno.openSync("/foo/bar.txt", { write: true });
const bytesWritten = file.writeSync(data); // 11

Parameters Jump to heading

Jump to headingp: Uint8Array

Return Type Jump to heading

number
Back to top