📅  最后修改于: 2022-03-11 15:02:56.832000             🧑  作者: Mango
handleFileChosen = async (file) => {
return new Promise((resolve, reject) => {
let fileReader = new FileReader();
fileReader.onload = () => {
resolve(fileReader.result);
};
fileReader.onerror = reject;
fileReader.readAsText(file);
});
}
readAllFiles = async (AllFiles) => {
const results = await Promise.all(AllFiles.map(async (file) => {
const fileContents = await handleFileChosen(file);
return fileContents;
}));
console.log(results);
return results;
}