Deno: Read File

By Xah Lee. Date: .

to read a file, use Deno.readTextFileSync.

you need to have the command line option --allow-read , example

deno run --allow-read "myscript.js"

/*
deno. reading a file
run the script with --allow-read
*/

const x = Deno.readTextFileSync( "myfile.txt" );

// print first line
console.log( x.split("\n")[1] )