Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var stringify = require('JSONStream').stringify(false);
- var Stream = require('stream').Stream;
- var input = new Stream;
- input.pipe(stringify);
- var output = new Stream;
- stringify.pipe(output);
- output.on('data', function (buf) {
- console.log('Output: ' + buf);
- });
- var iv = setInterval(function () {
- var n = Math.floor(Math.random() * 10);
- input.emit('data', n);
- }, 100);
Add Comment
Please, Sign In to add comment