diff --git a/lib/storage.js b/lib/storage.js index fe6ba0313..7afb26a8a 100644 --- a/lib/storage.js +++ b/lib/storage.js @@ -113,15 +113,22 @@ Storage.prototype.get_tarball = function(name, filename, callback) { }, 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); rstream2.on('error', function(err) { stream.emit('error', err); }); rstream2.on('data', function(data) { stream.write(data); + savestream.write(data); }); rstream2.on('end', function() { stream.end(); + savestream.end(); }); }); });