+31
-29
@@ -8,5 +8,5 @@ 'use strict'; | ||
| if (!callback) { | ||
| callback = options; | ||
| callback = options; | ||
| options = { | ||
| options = { | ||
| end: true | ||
@@ -25,27 +25,27 @@ }; | ||
| function pipe(allStreams, options, callback) { | ||
| var error, finish, end, open, | ||
| readError, writeError; | ||
| var error, finish, end, open; | ||
| var readError, writeError; | ||
| var streams = allStreams.slice(); | ||
| var read = streams.shift(); | ||
| var write = streams.pop(), | ||
| isGunzip = allStreams.some(function (write) { | ||
| return write instanceof zlib.Gunzip | ||
| }), | ||
| isGzip = allStreams.some(function (write) { | ||
| return write instanceof zlib.Gzip | ||
| }), | ||
| rm = function (event, stream, fn) { | ||
| stream.removeListener(event, fn); | ||
| }, | ||
| rmAll = function () { | ||
| rm('error', write, onWriteError); | ||
| rm('error', read, onReadError); | ||
| rm('end', read, onReadEnd); | ||
| rm('finish', write, onWriteFinish); | ||
| }; | ||
| var streams = allStreams.slice(); | ||
| var read = streams.shift(); | ||
| var write = streams.pop(); | ||
| var isGunzip = allStreams.some(function (write) { | ||
| return write instanceof zlib.Gunzip | ||
| }); | ||
| var isGzip = allStreams.some(function (write) { | ||
| return write instanceof zlib.Gzip | ||
| }); | ||
| var rm = function (event, stream, fn) { | ||
| stream.removeListener(event, fn); | ||
| }; | ||
| var rmAll = function () { | ||
| rm('error', write, onWriteError); | ||
| rm('error', read, onReadError); | ||
| rm('end', read, onReadEnd); | ||
| rm('finish', write, onWriteFinish); | ||
| }; | ||
| read.on('end', onReadEnd); | ||
@@ -57,7 +57,4 @@ read.on('error', onReadError); | ||
| read.on('readable', function () { | ||
| read.resume(); | ||
| }); | ||
| open = true; | ||
| open = true; | ||
| write.on('error', onWriteError); | ||
@@ -71,2 +68,7 @@ | ||
| finish = true; | ||
| read.on('readable', function () { | ||
| read.resume(); | ||
| }); | ||
| onError(error); | ||
@@ -73,0 +75,0 @@ onResult(); |
+31
-29
@@ -8,5 +8,5 @@ 'use strict'; | ||
| if (!callback) { | ||
| callback = options; | ||
| callback = options; | ||
| options = { | ||
| options = { | ||
| end: true | ||
@@ -25,27 +25,27 @@ }; | ||
| function pipe(allStreams, options, callback) { | ||
| let error, finish, end, open, | ||
| readError, writeError; | ||
| let error, finish, end, open; | ||
| let readError, writeError; | ||
| const streams = allStreams.slice(); | ||
| const read = streams.shift(); | ||
| const write = streams.pop(), | ||
| isGunzip = allStreams.some((write) => { | ||
| return write instanceof zlib.Gunzip | ||
| }), | ||
| isGzip = allStreams.some((write) => { | ||
| return write instanceof zlib.Gzip | ||
| }), | ||
| rm = (event, stream, fn) => { | ||
| stream.removeListener(event, fn); | ||
| }, | ||
| rmAll = () => { | ||
| rm('error', write, onWriteError); | ||
| rm('error', read, onReadError); | ||
| rm('end', read, onReadEnd); | ||
| rm('finish', write, onWriteFinish); | ||
| }; | ||
| const streams = allStreams.slice(); | ||
| const read = streams.shift(); | ||
| const write = streams.pop(); | ||
| const isGunzip = allStreams.some((write) => { | ||
| return write instanceof zlib.Gunzip | ||
| }); | ||
| const isGzip = allStreams.some((write) => { | ||
| return write instanceof zlib.Gzip | ||
| }); | ||
| const rm = (event, stream, fn) => { | ||
| stream.removeListener(event, fn); | ||
| }; | ||
| const rmAll = () => { | ||
| rm('error', write, onWriteError); | ||
| rm('error', read, onReadError); | ||
| rm('end', read, onReadEnd); | ||
| rm('finish', write, onWriteFinish); | ||
| }; | ||
| read.on('end', onReadEnd); | ||
@@ -57,7 +57,4 @@ read.on('error', onReadError); | ||
| read.on('readable', () => { | ||
| read.resume(); | ||
| }); | ||
| open = true; | ||
| open = true; | ||
| write.on('error', onWriteError); | ||
@@ -71,2 +68,7 @@ | ||
| finish = true; | ||
| read.on('readable', () => { | ||
| read.resume(); | ||
| }); | ||
| onError(error); | ||
@@ -73,0 +75,0 @@ onResult(); |
+1
-1
| { | ||
| "name": "pipe-io", | ||
| "version": "2.0.3", | ||
| "version": "2.0.4", | ||
| "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
15257
-0.55%