Skip to content

Instantly share code, notes, and snippets.



Forked from domenic/pipe-promises.js
Last active Aug 29, 2015
What would you like to do?
exports.pipe = function (source, sink) {
var resolve, reject;
return new Promise(function(resolve_, reject_) {
resolve = resolve_;
reject = reject_;
.on("error", reject)
.on("error", reject);
.on("finish", resolve);
}).finally(function() {
source.removeListener("error", reject);
sink.removeListener("error", reject);
sink.removeListener("finish", resolve);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment