|
@ -284,14 +284,25 @@ exports.exec = function () { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
exports.pump = function (readStream, writeStream, callback) { |
|
|
exports.pump = function (readStream, writeStream, callback) { |
|
|
|
|
|
if (!readStream.pause) readStream.pause = function () {readStream.emit("pause")}; |
|
|
|
|
|
if (!readStream.resume) readStream.resume = function () {readStream.emit("resume")}; |
|
|
|
|
|
|
|
|
readStream.addListener("data", function (chunk) { |
|
|
readStream.addListener("data", function (chunk) { |
|
|
if (writeStream.write(chunk) === false) readStream.pause(); |
|
|
if (writeStream.write(chunk) === false) readStream.pause(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
writeStream.addListener("pause", function () { |
|
|
|
|
|
readStream.pause(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
writeStream.addListener("drain", function () { |
|
|
writeStream.addListener("drain", function () { |
|
|
readStream.resume(); |
|
|
readStream.resume(); |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
writeStream.addListener("resume", function () { |
|
|
|
|
|
readStream.resume(); |
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
readStream.addListener("end", function () { |
|
|
readStream.addListener("end", function () { |
|
|
writeStream.end(); |
|
|
writeStream.end(); |
|
|
}); |
|
|
}); |
|
|