I figured out how to read one text file, but I am not sure how to read multiple text files in a local folder.
Using the code below, I can read a text file:
function readText(file) {
var text = '';
var rawFile = new XMLHttpRequest();
rawFile.open("GET", file, false);
rawFile.onreadystatechange = function() {
if (rawFile.readyState === 4 && rawFile.status === 200) {
text = rawFile.responseText;
}
}
rawFile.send(null);
return text;
}
Can anyone please help me figure out how I can do this for multiple files in one folder?
I do not know in advance what files will be in the folder, so I cannot simply repeat the above function multiple times.