W3cubDocs

/Deno

Deno.readAll

deprecated

Read Reader r until EOF (null) and resolve to the content as Uint8Array`.

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

// Example from file
const file = await Deno.open("my_file.txt", {read: true});
const myFileContent = await Deno.readAll(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 = await Deno.readAll(reader);
@deprecated

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

function readAll(r: Reader): Promise<Uint8Array>;
readAll(r: Reader): Promise<Uint8Array>

Parameters

Return Type

Promise<Uint8Array>

© 2018–2021 the Deno authors
https://doc.deno.land/deno/stable/~/Deno.readAll