Upon selecting an XML file with an open file dialog I want to read the contents of this file into some variable as a string.
I found here the following code. How can I return "theBytes" from processFile ?
Thank you in advance, Zvika
public processFile(theFile)
{
return function(e)
{
var theBytes = e.target.result;
console.log (theBytes);
}
}
var f = event.files[0];
let fileReader = new FileReader();
fileReader.onload = this.processFile(f);
fileReader.readAsText(f);