Improve zlib error handling. [#109]

Former-commit-id: f6d7dd9afb630125d55188401da037ed97d6e5c5
This commit is contained in:
Kit Cambridge
2012-11-09 14:24:08 -08:00
parent 905dd5a70f
commit bd00fcb875

View File

@@ -63,13 +63,15 @@
'Accept': 'application/vnd.github.v3.raw'
}
}, function(response) {
var decompressor = zlib.createUnzip().on('error', callback);
var parser = new tar.Extract({
'path': options.path
})
.on('end', callback)
.on('error', callback);
response.pipe(zlib.createUnzip()).pipe(parser);
response.pipe(decompressor).pipe(parser);
})
.on('error', callback);
}