Created
April 17, 2019 21:47
-
-
Save hinzundcode/d516776b840e6bf45c09b9d1a8b80597 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"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