Skip to content

Instantly share code, notes, and snippets.

@drobbins
Created December 5, 2014 02:32
Show Gist options
  • Save drobbins/44a6d4355e5d7edff6a6 to your computer and use it in GitHub Desktop.
Save drobbins/44a6d4355e5d7edff6a6 to your computer and use it in GitHub Desktop.
StringifyStream
stream = require "stream"
class StringifyStream extends stream.Transform
constructor: ->
super()
@_readableState.objectMode = false
@_writableState.objectMode = true
_transform: (obj, enc, done) ->
@push JSON.stringify obj, null, 2
done?()
module.exports = StringifyStream
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment