I am trying to load the text from a local text file into a JavaScript variable. The file will always be the same and no input is taken from the user for this within the HTML. I get the error that parameter 1 is not of type blob for readAsText(). Here is what I have:
function readNumber(){
var fr = new FileReader();
fr.readAsText("C:/Users/home/Documents/Hello_World/src/main/resources/static/numbers.txt");
var number = fr.result;
}
input type=fileFileReader cannot be used to simply read a file by pathname from a file system.So as suggested by @enhzflep, file should be selected by user before reading it using FileReader.file:///path. They are incorrect