title: How to select files from a ZIP file on client-side with jszip
body: <p>I would like process a quite large ZIP file, in which I just would like to extract some PDF files and then upload them to a server. I already have in my app a function that takes an Array of File, send them and get the results of the processing from the server.</p>
  
  <p>My concern is how to set up an equivalent Array of File from the ZIP.</p>
  
  <p>I have tested both zip.js and jszip.js, but I got some strange results.
  Here is my code with jszip</p>
  
  <pre class="lang-js prettyprint-override"><code>async function unzipAndSelect( zipFile ) {
     var flist = [];
     var zip = await JSZip.loadAsync(zipFile);
     await zip.forEach( async function (relativePath, zipEntry) {
  
        var match = zipEntry.name.match( /REGEX.pdf$/ );
        if(match) {
           var blob = await zip.file( zipEntry.name ).async("blob");
           var file = new File( [blob], zipEntry.name, {type : 'application/pdf'} );
           flist.push( file );
        }
     });
     console.log( fileList );
     return flist;
  }
  
  uploadPDFs( fileList ) {
     if(fileList.length) {
        fileList.forEach( function(f) {
           // upload stuff ...
        }
     }
  }
  
  var fileList = unzipAndSelect( "myfile.zip" );
  uploadPDFs( fileList );
  
  </code></pre>
  
  <p>The fileList seems to be populated but its length remains at zero. When I remove the test on the length, nothing happens. Is my approach correct ? Any help on what happens ?</p>