Closed feiyuw closed 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?
change "finish" to "close" solve this issue, but I got another one, once zip file contain an empty file, the code will fail to fire "close" event.
My code is as below:
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?