Ende.readTextFileSync

function ยท requires --allow-read

function Ende.readTextFileSync(path: string | URL): string

Synchronously reads and returns the entire contents of a file as an UTF-8 decoded string.

const data = Ende.readTextFileSync("hello.txt");
console.log(data);

Throws if the operation fails, for example with Ende.errors.NotFound if the file does not exist, Ende.errors.IsADirectory if path refers to a directory, or Ende.errors.PermissionDenied if the required permission has not been granted.

Requires allow-read permission.