read file javascript

JavaScript
'use strict'

const fs = require('fs');

let fileContent = fs.readFileSync('/path/to/myfile', 'utf-8');
console.log(fileContent);// As with JSON, use the Fetch API & ES6
fetch('something.txt')
  .then(response => response.text())
  .then(data => {
  	// Do something with your data
  	console.log(data);
  });const fileList = event.target.files;
let fileContent = "";

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

fr.readAsText(fileList[0]);
Source

Also in JavaScript: