Comparing version 1.1.29 to 1.1.30
@@ -41,2 +41,9 @@ (function () { | ||
rmAll = function() { | ||
rm('error', write, onWriteError); | ||
rm('error', read, onReadError); | ||
rm('end', read, onReadEnd); | ||
rm('finish', write, onWriteFinish); | ||
}, | ||
onWriteError = function(error) { | ||
@@ -72,7 +79,9 @@ writeError = true; | ||
if (options.end) | ||
write.once('finish', onWriteFinish); | ||
write.on('finish', onWriteFinish); | ||
read.once('end', onReadEnd); | ||
read.once('error', onReadError); | ||
write.once('error', onWriteError); | ||
read.on('end', onReadEnd); | ||
read.on('error', onReadError); | ||
write.on('error', onWriteError); | ||
setListeners(streams, onError); | ||
@@ -88,21 +97,13 @@ fullPipe(allStreams, options); | ||
function onResult() { | ||
var justEnd = end && !isFsWrite, | ||
justFinish = write && !isFsRead, | ||
bothFinish = end && finish; | ||
if (readError && finish) { | ||
rm('error', write, onWriteError); | ||
rm('end', read, onReadEnd); | ||
onEnd(); | ||
} else if (writeError && readError) { | ||
rm('end', read, onReadEnd); | ||
rm('finish', write, onWriteFinish); | ||
onEnd(); | ||
} else if (writeError && end) { | ||
rm('finish', write, onWriteFinish); | ||
rm('error', read, onReadError); | ||
onEnd(); | ||
} else if ((end && !isFsWrite) || (write && !isFsRead) || (write && end)) { | ||
rm('error', read, onReadError); | ||
rm('error', write, onWriteError); | ||
} else if (bothFinish || justEnd || justFinish) { | ||
onEnd(); | ||
@@ -113,2 +114,3 @@ } | ||
function onEnd() { | ||
rmAll(); | ||
unsetListeners(streams, onError); | ||
@@ -115,0 +117,0 @@ |
{ | ||
"name": "pipe-io", | ||
"version": "1.1.29", | ||
"version": "1.1.30", | ||
"author": "coderaiser <mnemonic.enemy@gmail.com> (https://github.com/coderaiser)", | ||
@@ -5,0 +5,0 @@ "description": "Pipe streams and handle events", |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10494
163