How to find out when the npm `unzip` module finished unpacking the file?

I am using a module unzipfrom npm to extract the contents of a zip archive. I need to know when this is done, extract, and the file is completely written to disk.

My code is:

fs.createReadStream('master.zip').pipe(unzip.Extract({ path: 'gitdownloads/repo' }));

What I tried:

My first thought was that I could use the stream and listen to the finish event, but unzipit only accepts input: it does not return another stream.

I also looked to see if there is a unzipcallback in the module . Bad luck.

+4
source share
1 answer

From github README

"", zip .

- :

fs.createReadStream('master.zip')
  .pipe(unzip.Extract({ path: 'gitdownloads/repo' }))
   .on('close', function () {
     ...
   });
+8

All Articles