Skip to content

Instantly share code, notes, and snippets.

@michaellopez
Created March 27, 2013 08:38
Show Gist options
  • Select an option

  • Save michaellopez/5252717 to your computer and use it in GitHub Desktop.

Select an option

Save michaellopez/5252717 to your computer and use it in GitHub Desktop.
node-unzip event testcase
var unzip = require('unzip');
var path = 'output';
var file = 'file.zip';
var unzipStream = unzip.Extract({ path: path });
unzipStream.on('finish', function () { console.log('Zipstream Finish') });
unzipStream.on('data', function () { console.log('Zipstream Data') });
unzipStream.on('error', function () { console.log('Zipstream Error') });
unzipStream.on('close', function () { console.log('Zipstream Close') });
unzipStream.on('end', function () { console.log('Zipstream End') });
var readStream = fs.createReadStream(file);
readStream.pipe(unzipStream);
readStream.on('finish', function () { console.log('Readstream Finish') });
readStream.on('data', function () { console.log('Readstream Data') });
readStream.on('error', function () { console.log('Readstrem Error') });
readStream.on('close', function () { console.log('Readstream Close') });
readStream.on('end', function () { console.log('Readstream End') });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment