Skip to content

Instantly share code, notes, and snippets.

@mjackson
Created December 31, 2015 04:40
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 mjackson/54a47e61b0066c796930 to your computer and use it in GitHub Desktop.
Save mjackson/54a47e61b0066c796930 to your computer and use it in GitHub Desktop.
var JSONStream = require('jsonstream')
var es = require('event-stream')
function handleRequest(data, callback) {
callback(null, JSON.stringify(data) + '\n')
}
process.stdin
.pipe(JSONStream.parse())
.pipe(es.map(handleRequest))
.pipe(process.stdout)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment