title: TypeError: Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'
body: <p>I'm writing an chrome application with scala.js, and have some file reading problem.</p>
  
  <p>When I use <code>chrome.fileSystem.chooseEntry</code> with <code>openDirectory</code> to select a directory, I want to read the <code>_meta_.json</code> file inside, the code is:</p>
  
  <pre><code>chrome.fileSystem.chooseEntry(js.Dynamic.literal("type" -&gt; "openDirectory"), (dir: Entry) =&gt; {
      dir.getFile("_meta_.json", js.Dynamic.literal(), (entry: FileEntry) =&gt; {
          entry.file((file: FileEntry) =&gt; {
            val reader = new FileReader()
            reader.onload = (event: UIEvent) =&gt; {
              println("############ read file: " + event)
            }
            reader.onloadend = (event: ProgressEvent) =&gt; {
              println("############ read file: " + reader.result)
              ()
            }
            reader.onerror = (event: Event) =&gt; {
              println("######### read error")
              ()
            }
  
            println("###### going to read")
            reader.readAsText(entry.asInstanceOf[Blob]) // !!!!
            ()
          })
      })
  })
  </code></pre>
  
  <p>(The code here is simplified, if you want to see the accurate code, please refer to <a href="https://github.com/freewind/fast-links/blob/master/src/main/scala/in/freewind/fastlinks/chrome_app/config/Header.scala#L45" rel="nofollow">https://github.com/freewind/fast-links/blob/master/src/main/scala/in/freewind/fastlinks/chrome_app/config/Header.scala#L45</a>)</p>
  
  <p>But when the code is running, it doesn't print anything, seems the file is never read. Then I set a debugger and stepped into the line ends with <code>// !!!!</code>, and run the code in console:</p>
  
  <pre><code>reader.readAsText(this.entry$1$2)
  </code></pre>
  
  <p>It reports error:</p>
  
  <pre><code>TypeError: Failed to execute 'readAsText' on 'FileReader': parameter 1 is not of type 'Blob'.
  </code></pre>
  
  <p>It clearly shows the reason, but I don't know how to fix it. I searched but all the similar examples are using the file input file from html DOM.</p>
  
  <p>How to read the file correctly?</p>