reading files in javascript

JavaScript
'use strict'

const fs = require('fs');

let fileContent = fs.readFileSync('/path/to/myfile', 'utf-8');
console.log(fileContent);const fileList = event.target.files;
let fileContent = "";

const fr = new FileReader();
fr.onload = () => {
  fileContent = fr.result;
  console.log('Commands', fileContent);
}

fr.readAsText(fileList[0]);<embed src="file.txt"> // This will show the text contained in file.txt in the page
Source

Also in JavaScript: