title: Node Unzipper - how to know it's finished
body: <p>I'm trying to use the unzipper node module to extract and process a number of files (exact number is unknown).  However, I can't seem to figure out how to know when all the files are processed.  So far, my code looks like this:</p>
  
  <pre><code>s3.getObject(params).createReadStream()
  .pipe(unzipper.Parse())
  .on('entry', async (entry) =&gt; {
      var fileName = entry.path;
      if (fileName.match(someRegex)) {
          await processEntry(entry);
          console.log("Uploaded");
      } else {
          entry.autodrain();
          console.log("Drained");
      }
  });
  </code></pre>
  
  <p>I'm trying to figure out how to know that unzipper has gone through all the files (i.e., no more <code>entry</code> events are forthcoming) <em>and</em> all the <code>entry</code> handlers have finished so that I know I've finished processing all the files I care about.</p>
  
  <p>I've tried experimenting with the <code>close</code> and <code>finish</code> events but when I have, they both trigger before <code>console.log("Uploaded");</code> has printed, so that doesn't seem right.</p>
  
  <p>Help?</p>