Created
December 7, 2020 21:45
-
-
Save miladvafaeifard/8841254e00a8f21705826edd7745d9c1 to your computer and use it in GitHub Desktop.
Transform streams in Nodejs system
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
import { Transform } from 'stream'; | |
const upperCaseTransform = new Transform({ | |
transform(chunk, encoding, next) { | |
this.push(chunk.toString().toUpperCase()); | |
next(); | |
} | |
}); | |
process.stdin.pipe(upperCaseTransform).pipe(process.stdout); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment