Skip to content

Instantly share code, notes, and snippets.

@dmamills
Created December 19, 2013 14:26
Show Gist options
  • Save dmamills/8039879 to your computer and use it in GitHub Desktop.
Save dmamills/8039879 to your computer and use it in GitHub Desktop.
nodeschool stream-adventure
var tar = require('tar'),
through = require('through'),
zlib = require('zlib'),
crypto = require('crypto');
var parser = tar.Parse();
parser.on('entry',function(e) {
if(e.type ==='File') {
var md = crypto.createHash('md5',{encoding:'hex'});
e.pipe(md).pipe(through(null,function() {
this.queue(' ' + e.path + '\n');
})).pipe(process.stdout);
}
});
process.stdin
.pipe(crypto.createDecipher(process.argv[2],process.argv[3]))
.pipe(zlib.createGunzip())
.pipe(parser);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment