1handleFileChosen = async (file) => {
2 return new Promise((resolve, reject) => {
3 let fileReader = new FileReader();
4 fileReader.onload = () => {
5 resolve(fileReader.result);
6 };
7 fileReader.onerror = reject;
8 fileReader.readAsText(file);
9 });
10}
11
12
13readAllFiles = async (AllFiles) => {
14 const results = await Promise.all(AllFiles.map(async (file) => {
15 const fileContents = await handleFileChosen(file);
16 return fileContents;
17 }));
18 console.log(results);
19 return results;
20}
21