writeAll

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

function

async function writeAll(writer: Writer, data: Uint8Array): Promise<void>

Write all the content of the array buffer (arr) to the writer (w).

writer: Writer

The writer to write to

data: Uint8Array

The data to write

Example: Writing to stdout

import { writeAll } from "@ende/io/write-all";

const contentBytes = new TextEncoder().encode("Hello World");
await writeAll(Ende.stdout, contentBytes);

Example: Writing to file

import { writeAll } from "@ende/io/write-all";

const contentBytes = new TextEncoder().encode("Hello World");
using file = await Ende.open('test.file', { write: true });
await writeAll(file, contentBytes);

Source