Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/ayonli_jsext/lib.deno.d.ts>Deno.FsFile#write

A JavaScript extension package for building strong and modern applications.
Latest
method Deno.FsFile.prototype.write
import { Deno } from "https://deno.land/x/ayonli_jsext@v0.9.72/lib.deno.d.ts";
const { FsFile } = Deno;

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

p: Uint8Array

Returns

Promise<number>