Created
December 19, 2013 14:26
-
-
Save dmamills/8039879 to your computer and use it in GitHub Desktop.
nodeschool stream-adventure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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