Skip to content

Instantly share code, notes, and snippets.

@joyrexus
Created February 18, 2014 16:13
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 joyrexus/9074011 to your computer and use it in GitHub Desktop.
Save joyrexus/9074011 to your computer and use it in GitHub Desktop.
concat stdin using Transform stream
concat = require('stream').Transform()
concat.buffers = []
concat._transform = (buff, enc, next) ->
@buffers.push buff
next()
concat._flush = (done) ->
process.stdout.write Buffer.concat(@buffers).toString()
done()
process.stdin.pipe(concat)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment