Skip to main content
Module

x/netzo/deno.d.ts>Deno.writeAllSync

SDK for Netzo, the open Web platform to unify IoT devices, applications and services.
Go to Latest
function Deno.writeAllSync
Deprecated
Deprecated

Use writeAllSync from https://deno.land/std/streams/conversion.ts instead. Deno.writeAllSync will be removed in Deno 2.0.

import { Deno } from "https://deno.land/x/netzo@v0.1.10/deno.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

arr: Uint8Array