-
-
Save ipiyer/24fd8583255e1dd280ecb02c1f18aa01 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| const { Transform } = require('stream'); | |
| const {aStream, bStream } = require("other_file"); | |
| class Convert extends Transform { | |
| constructor() { | |
| super(); | |
| this.aStream | |
| .pipe(bStream) | |
| bStream | |
| .on('data', data => this.cb(null, this.chunk)); | |
| } | |
| _transform(chunk, encoding, cb) { | |
| // is there a better way to do this without assigining cb to this? | |
| this.cb = cb; | |
| this.chunk = chunk; | |
| this.aStream.write(chunk); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment