title: How to read file zip using JSZip in Firefox SDK
body: <p>I want to make addons to work to extract the zip file locally like this (<a href="https://stuk.github.io/jszip/documentation/examples/read-local-file-api.html" rel="nofollow">here</a>). But I have a problem when making use firefox SDK. Which can not be read zip because somethings wrong when get path of <strong>fileinput</strong> and errors unsupported format because <strong>dataType</strong> not ArrayBuffer.</p>
  
  <p><strong>HTML</strong> </p>
  
  <pre><code>&lt;input type="file" name="file" id="import" class="hide" /&gt;
  </code></pre>
  
  <p><strong>myscript.js</strong></p>
  
  <pre><code>var fileInput = document.getElementById('import');
  fileInput.addEventListener('change', function(e) {
      var zipFileToLoad = fileInput.files[0];
      var tampJson = [];
      JSZip.loadAsync(zipFileToLoad)
              .then(function(zip) {
                  console.dir(zip);
                  zip.forEach(function (relativePath, zipEntry) {
                      if(zipEntry.dosPermissions == null){
                          alert('Permissions trouble !')
                      }
                      if(typeof(zipEntry['_data']['compressedContent']) != 'undefined'){
                          //var text = String.fromCharCode.apply(null, new Uint8Array(zipEntry['_data']['compressedContent']));
                          var text = new TextDecoder("utf-8").decode(zipEntry['_data']['compressedContent']);
                          var dec = text.toString();
  
                          var json = JSON.parse(dec);
                          if(json != null){
                              var keys = ['name', 'description', 'data', 'created_at', 'updated_at'];
                              keys.forEach(function(key){
                                  if (key in json){
                                      if(key == keys[keys.length - 1]){
                                          tampJson.push(json);
                                      }
                                  }else{
                                      dialog({
                                          title: "Warning",
                                          description: "&lt;b&gt;Wrong format, &lt;/b&gt; are you sure to continue?",
                                          yesButton: "yes",
                                          cancelButton: "No",
                                          yesCallback: function() {
                                              $(this).closest('.overlay').removeClass("active");
                                          },
                                          cancelCallback: function() {
                                              $(this).closest('.overlay').removeClass("active");
                                              return false;
                                          }
                                      });
                                  }
                              });
                          }else{
                              alert('format parse gagal');
                          }
                      }
                  });
                  if(tampJson.length &gt; 0){
                      saveByImport(tampJson, 0);
                  }else{
                      alert('Oops file empty');
                  }
              }, function (e) {
                  alert('Oops import fail '+ e);
              });
  </code></pre>
  
  <p>Can't error in console. I just can not ArrayBuffer from fileinput. 
  This script can work in chrome extension but not work in firefox sdk.
  So please help me for solving this problem.</p>