feature(pipe) rm Util.exec

This commit is contained in:
coderaiser 2014-10-31 11:34:07 -04:00
parent 9b9e50efd1
commit d5b50a9383

View file

@ -25,7 +25,7 @@
* @param callback - function(error) {}
*/
function create(read, write, options, callback) {
var gzip, isFsWrite, func,
var gzip, isFsWrite,
isStrRead = type.string(read),
isStrWrite = type.string(write),
isFunc = type.function(options),
@ -34,15 +34,13 @@
bufferSize: 4 * 1024
};
Util.checkArgs(arguments, ['read', 'write', 'options']);
Util.checkArgs(arguments, ['read', 'write', 'callback']);
if (isFunc)
callback = options;
else
o = options;
func = Util.exec.ret(callback);
if (options.range)
Util.extend(optionsRead, {
start : o.range.start,
@ -64,19 +62,19 @@
else
gzip = zlib.createGunzip();
on('error', read, func);
on('error', read, callback);
read = read.pipe(gzip);
}
on('error', write, func);
on('error', read, func);
on('error', write, callback);
on('error', read, callback);
Util.exec.if(!isFsWrite, function() {
read.pipe(write, {
end: !o.notEnd
});
on('end', read, func);
on('end', read, callback);
}, function(callback) {
on('open', write, callback);
});