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

x/levo/lib/lib.deno_runtime.d.ts>Deno.writeAllSync

Server side rendering with The Elm Architecture in Deno
Latest
function Deno.writeAllSync
import { Deno } from "https://deno.land/x/levo@v0.0.27/lib/lib.deno_runtime.d.ts";
const { writeAllSync } = Deno;

Synchronously write all the content of the array buffer (arr) to the writer (w).

// Example writing to stdout
const contentBytes = new TextEncoder().encode("Hello World");
Deno.writeAllSync(Deno.stdout, contentBytes);

// Example writing to file
const contentBytes = new TextEncoder().encode("Hello World");
const file = Deno.openSync('test.file', {write: true});
Deno.writeAllSync(file, contentBytes);
Deno.close(file.rid);

// Example writing to buffer
const contentBytes = new TextEncoder().encode("Hello World");
const writer = new Deno.Buffer();
Deno.writeAllSync(writer, contentBytes);
console.log(writer.bytes().length);  // 11

Parameters

w: WriterSync
arr: Uint8Array