Skip to main content
Module

x/deno/js/files.ts>write

A modern runtime for JavaScript and TypeScript.
Go to Latest
function write
import { write } from "https://deno.land/x/deno@v0.17.0/js/files.ts";

Write to the file ID the contents of the array buffer.

Resolves with the number of bytes written.

 (async () => {
   const encoder = new TextEncoder();
   const data = encoder.encode("Hello world\n");
   const file = await Deno.open("/foo/bar.txt");
   await Deno.write(file.rid, data);
 })();

Parameters

rid: number
p: Uint8Array

Returns

Promise<number>