Created
January 24, 2021 03:50
-
-
Save bbachi/eb8f331210cb0befdc01dfaab05634ca to your computer and use it in GitHub Desktop.
NodeJS Stream
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
const { Readable } = require('stream'); | |
const data = [ | |
"This is the stream data 1", | |
"This is the stream data 2", | |
"This is the stream data 3", | |
"This is the stream data 4", | |
"This is the stream data 5" | |
]; | |
const readableStream = Readable.from(data); | |
readableStream.on('data', (data) => { | |
console.log('Received Data ', data.toString()); | |
}); | |
readableStream.on('end', () => { | |
console.log('End of data!!!'); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment