why when i read file content i find html txt code example
Example 1: javascript read file lines into array vanilla
const fileList = event.target.files;
let fileContent = "";
const fr = new FileReader();
fr.onload = () => {
fileContent = fr.result;
console.log('Commands', fileContent);
}
fr.readAsText(fileList[0]);
Example 2: html get text from file
<embed src="file.txt"> // This will show the text contained in file.txt in the page