Working with the HTML5 files Api

Working with the HTML5 files Api


Happy Sunday everyone!
I’m preparing to make an advanced markup viewer with react and electron, etc. I’d like to be able to read and write files. At least, I’d definitely like to load files. I’ve tried using the html5 localFiles Api, but I’ve had trouble getting the data in order to view a file. Any ideas? I’ll make a pen here:


I solved it, partly. The following code block, though I’m not sure how, reads files through the fileReader object.

function drop(e) {
var files = e.dataTransfer.files;
  var reader = new FileReader();
  reader.onload = (function(file) {
    return function(e) 
    {output.innerText =}