1// As with JSON, use the Fetch API & ES6
2fetch('something.txt')
3 .then(response => response.text())
4 .then(data => {
5 // Do something with your data
6 console.log(data);
7 });
1const fileUrl = '' // provide file location
2
3fetch(fileUrl)
4 .then( r => r.text() )
5 .then( t => console.log(t) )
6
1const fileList = event.target.files;
2let fileContent = "";
3
4const fr = new FileReader();
5fr.onload = () => {
6 fileContent = fr.result;
7 console.log('Commands', fileContent);
8}
9
10fr.readAsText(fileList[0]);