W3cubDocs

/Deno

Deno.readAllSync

deprecated

Synchronously reads Reader r until EOF (null) and returns the content as Uint8Array.

// Example from stdin
const stdinContent = Deno.readAllSync(Deno.stdin);

// Example from file
const file = Deno.openSync("my_file.txt", {read: true});
const myFileContent = Deno.readAllSync(file);
Deno.close(file.rid);

// Example from buffer
const myData = new Uint8Array(100);
// ... fill myData array with data
const reader = new Deno.Buffer(myData.buffer as ArrayBuffer);
const bufferContent = Deno.readAllSync(reader);
@deprecated

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

function readAllSync(r: ReaderSync): Uint8Array;
readAllSync(r: ReaderSync): Uint8Array

Parameters

Return Type

Uint8Array