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

x/deno/cli/js/deno.ts>writeSync

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

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

Resolves with the number of bytes written.

  const encoder = new TextEncoder();
  const data = encoder.encode("Hello world\n");
  const file = Deno.openSync("/foo/bar.txt");
  Deno.writeSync(file.rid, data);

Parameters

rid: number
p: Uint8Array

Returns

number