title: How to read local files using HTML 5 FileReader?
body: <h2>Objective</h2>
  
  <p>I am making an application, and I need to read a local file using JavaScript and HTML 5, without any <code>&lt;input&gt;</code> tags or user interaction whatsoever.</p>
  
  <h2>What I tried</h2>
  
  <p>On my research, I found two tutorials that are heavily cited in SO:</p>
  
  <ul>
  <li><a href="https://www.html5rocks.com/en/tutorials/file/dndfiles/" rel="noreferrer">https://www.html5rocks.com/en/tutorials/file/dndfiles/</a></li>
  <li><a href="http://blog.teamtreehouse.com/reading-files-using-the-html5-filereader-api" rel="noreferrer">http://blog.teamtreehouse.com/reading-files-using-the-html5-filereader-api</a></li>
  </ul>
  
  <p>However, there is a problem. Both of this tutorials require user interaction via the <code>input</code> tag, which is a life killer since I want to read the contents of the file automatically into a string. </p>
  
  <h2>Code</h2>
  
  <p>So far I managed to get the following code:</p>
  
  <pre><code>let readFile = function(path) {
      let reader = new FileReader();
  
      reader.onload = function(e) {
          var text = reader.result;
          console.log(text);
      };
  
      // Read in the image file as a data URL.
      reader.readAsText(MissingFileHandle);
  };
  </code></pre>
  
  <p>But as you can see, I am missing an important step, I am missing <code>MissingFileHandle</code>. My idea would be to pass a <code>path</code> to this method, and so the method would read the file locally as text and print it into the console, but I am unable to achieve this.</p>
  
  <h2>Question</h2>
  
  <p>Given a relative path, how can I read the contents of a file using HTML 5 without using <code>&lt;input&gt;</code> tags?</p>