0
Fork 0
mirror of https://github.com/verdaccio/verdaccio.git synced 2024-12-16 21:56:25 -05:00

caching tarballs

This commit is contained in:
Alex Kocharin 2013-06-20 20:54:50 +04:00
parent dfd0459c03
commit b4688d140f

View file

@ -113,15 +113,22 @@ Storage.prototype.get_tarball = function(name, filename, callback) {
}, self.config); }, self.config);
} }
var savestream = self.local.add_tarball(name, filename);
savestream.on('error', function(err) {
stream.emit('error', err);
});
var rstream2 = uplink.get_url(file.url); var rstream2 = uplink.get_url(file.url);
rstream2.on('error', function(err) { rstream2.on('error', function(err) {
stream.emit('error', err); stream.emit('error', err);
}); });
rstream2.on('data', function(data) { rstream2.on('data', function(data) {
stream.write(data); stream.write(data);
savestream.write(data);
}); });
rstream2.on('end', function() { rstream2.on('end', function() {
stream.end(); stream.end();
savestream.end();
}); });
}); });
}); });