Transform Uppercase Stream
NodeJS
Medium
3 views
Problem Description
Read stdin, convert to uppercase, write to stdout.
Input Format
stdin: text.
Output Format
Print transformed text.
Constraints
Use a Transform stream.
Official Solution
const { Transform } = require('stream');
const upper = new Transform({
transform(chunk, enc, cb) {
cb(null, chunk.toString('utf8').toUpperCase());
}
});
process.stdin.pipe(upper).pipe(process.stdout);
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!