Skip to main content

write

method Deno.FsFile.prototype.write
Jump to headingFsFile.prototype.write(p: Uint8Array): Promise<number>

Write the contents of the array buffer (p) to the file.

Resolves to 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 = await Deno.open("/foo/bar.txt", { write: true });
const bytesWritten = await file.write(data); // 11

Parameters Jump to heading

Jump to headingp: Uint8Array

Return Type Jump to heading

Promise<number>
Back to top