Created
December 22, 2019 15:42
-
-
Save slikts/4c50addbec74975fd8606d78b9a3be5c 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
export const mapStream = <A, B>(f: (a: A) => B, source: Readable) => | |
source.pipe( | |
new Transform({ | |
objectMode: true, | |
transform: (chunk, _, callback) => { | |
callback(null, f(chunk)); | |
} | |
}) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment