Skip to content

Instantly share code, notes, and snippets.

@hinzundcode
Created April 17, 2019 21:47
Show Gist options
  • Save hinzundcode/d516776b840e6bf45c09b9d1a8b80597 to your computer and use it in GitHub Desktop.
Save hinzundcode/d516776b840e6bf45c09b9d1a8b80597 to your computer and use it in GitHub Desktop.
"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