Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

Deno.readTextFileSync

Synchronously reads and returns the entire contents of a file as utf8 encoded string. Reading a directory throws an error.

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

Requires allow-read permission.

function readTextFileSync(path: string | URL): string;
§
readTextFileSync(path: string | URL): string
[src]

§Parameters

§
path: string | URL
[src]

§Return Type

§
string
[src]