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

std/io/read_all.ts>readAll

Deno standard library
Go to Latest
The Standard Library has been moved to JSR. See the blog post for details.
function readAll
import { readAll } from "https://deno.land/std@0.220.0/io/read_all.ts";

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

Examples

Example 1

import { readAll } from "https://deno.land/std@0.220.0/io/read_all.ts";

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

// Example from file
using file = await Deno.open("my_file.txt", {read: true});
const myFileContent = await readAll(file);

Returns

Promise<Uint8Array>