readAllSync

import { readAllSync } from "jsr:@ende/io";

function

function readAllSync(reader: ReaderSync): Uint8Array

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

reader: ReaderSync

The reader to read from

Returns

The content as Uint8Array

Example: Usage

import { readAllSync } from "@ende/io/read-all";

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

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

Source