Skip to content

Instantly share code, notes, and snippets.

@mafintosh
Created March 14, 2014 11: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 mafintosh/9546304 to your computer and use it in GitHub Desktop.
Save mafintosh/9546304 to your computer and use it in GitHub Desktop.
var JSONStream = require('JSONStream');
// server ...
var stringify = JSONStream.stringify();
stringify.pipe(stream);
terminal.on('stdout', function(id, dock, data) {
stringify.write({
id: id,
dock: dock,
data: data.toString()
});
});
// client ...
var parse = JSONStream.parse('*');
parse.on('data', function(data) {
console.log('her er et object', data);
});
stream.pipe(parse);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment