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:
parent
593e6195c7
commit
f19f523e1a
1 changed files with 7 additions and 4 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue