Readable From Generator
NodeJS
Medium
3 views
Problem Description
Create a readable stream from a generator and print output.
Output Format
Print lines.
Constraints
Use Readable.from.
Official Solution
const { Readable } = require('stream');
function* gen() {
yield 'meetcode-1\
';
yield 'meetcode-2\
';
}
Readable.from(gen()).pipe(process.stdout);
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!