Ende.readTextFile

function ยท requires --allow-read

function Ende.readTextFile(path: string | URL, options?: ReadFileOptions): Promise<string>

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

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

The returned promise rejects 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.