Ende.readFileSync

function ยท requires --allow-read

function Ende.readFileSync(path: string | URL): Uint8Array<ArrayBuffer>

Synchronously reads and returns the entire contents of a file as an array of bytes. TextDecoder can be used to transform the bytes to string if required. Throws an error when reading a directory.

const decoder = new TextDecoder("utf-8");
const data = Ende.readFileSync("hello.txt");
console.log(decoder.decode(data));

Requires allow-read permission.