Skip to content

Instantly share code, notes, and snippets.

@bbachi
Created January 24, 2021 03:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bbachi/eb8f331210cb0befdc01dfaab05634ca to your computer and use it in GitHub Desktop.
Save bbachi/eb8f331210cb0befdc01dfaab05634ca to your computer and use it in GitHub Desktop.
NodeJS Stream
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