Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Readable.prototype.pipe = function(dest) {
this.on('end', dest.end.bind(dest));
flow.call(this);
function flow() {
var chunk;
while (chunk = this.read()) {
var written = dest.write(chunk);
if (!written) {
dest.once('drain', flow.bind(this));
return;
}
}
this.once('readable', flow);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.