EvanOxfeld / node-unzip

node.js cross-platform unzip using streams
MIT License
613 stars 343 forks source link

Is there any way to get entry path list #90

Closed feiyuw closed 8 years ago

feiyuw commented 8 years ago

My code is as below:


    var fs = require('fs');
    var entries = [];
    var srcStream = fs.createReadStream('test.zip');
    srcStream.pipe(unzip.Parse())
    .on('entry', function(entry) {
      entries.push(entry.path);
      entry.autodrain();
    })
    .on('finish', function() {
      console.log(entries);
    });

But the output is always "[]", it seems when "finish" event got, the operation on "entry" event is not finished.

Is there any solutions that I can get all the entry list?

feiyuw commented 8 years ago

change "finish" to "close" solved my issue.