📜  在 javascript 代码示例中读取文本文件

📅  最后修改于: 2022-03-11 15:01:19.906000             🧑  作者: Mango

代码示例4
const fileList = event.target.files;
let fileContent = "";

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

fr.readAsText(fileList[0]);