Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
"use strict";
const { Transform } = require("stream");
function createStreamPair() {
let config = {
objectMode: true,
transform(chunk, encoding, callback) {
this.other.push(chunk);
callback();
}
};
let a = new Transform(config);
let b = new Transform(config);
a.other = b;
b.other = a;
return [a, b];
}
module.exports = { createStreamPair };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment