title: Understanding Papaparse with local file
body: <p>I am trying to understand how to properly implement Papaparse with a local file.  I have looked at a lot of online resources, and the approach they take is this</p>
  
  <pre><code>loadTextFromFile (event) {
      if (!event.target.files[0]) {
          alert('Upload a file.')
      } else {
          let file = event.target.files[0];
          if (file) {
              let reader = new FileReader();
              let config = {
                  delimiter: "",
                  newline: "",
                  quoteChar: '"',
                  escapeChar: '"',
                  header: true,
                  trimHeaders: false
              };
  
              reader.onload = e =&gt; this.$emit('load', Papa.parse(event.target.result, config));
              reader.onload = function (event) {
                  let results = Papa.parse(event.target.result, config);
                  console.log('PAPA RESULT: ', results.data);
                  console.log('ROWS:', event.target.result);
              };
              reader.readAsText(file);
  
          } else {
              alert('Please select a file to upload.')
          }
      }
  }
  </code></pre>
  
  <p>So they use a FileReader and it doesnt seem to load the file until the end within <code>readAsText</code>.  However, the above example works perfectly, although I still need to fully understand the code.</p>
  
  <p>Then there are other examples, which seem to do it without a FileReader</p>
  
  <pre><code>loadTextFromFile (event) {
      if (!event.target.files[0]) {
          alert('Upload a file.')
      } else {
          let file = event.target.files[0];
          if (file) {
              Papa.parse(file, {
                  header: true,
                  dynamicTyping: true,
                  complete: function(results) {
                      console.log(results.data)
                  }
              });
  
          } else {
              alert('Please select a file to upload.')
          }
      }
  }
  </code></pre>
  
  <p>Once again, this works perfectly.  So what I am trying to understand is why do people sometimes use the FileReader, and perhaps an explanation as to what exactly is happening in the first example.  </p>
  
  <p>What option should I be using?</p>
  
  <p>Thanks</p>