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

fixing bugs with streams

This commit is contained in:
Alex Kocharin 2013-07-12 23:51:04 +04:00
parent 593e6195c7
commit f19f523e1a

View file

@ -42,7 +42,7 @@ function write_stream(name) {
this.queue(data);
}, function() {
this.queue(null);
});
}, {autoDestroy: false});
stream.pause();
fs.exists(name, function(exists) {
@ -54,11 +54,14 @@ function write_stream(name) {
file.write(data);
});
stream.on('end', function() {
file.on('close', function() {
fs.rename(tmpname, name, function(err) {
if (err) stream.emit('error', err);
stream.emit('close');
});
});
file.destroySoon();
});
stream.resume();
});
return stream;