import { Deno } from "https://deno.land/x/deno@v1.0.0/cli/js/lib.deno.ns.d.ts";
const { writeSync } = Deno;
Synchronously write to the resource ID (rid
) the contents of the array
buffer (data
).
Returns the number of bytes written.
const encoder = new TextEncoder();
const data = encoder.encode("Hello world");
const file = Deno.openSync("/foo/bar.txt");
const bytesWritten = Deno.writeSync(file.rid, data); // 11
Deno.close(file.rid);