Created
December 5, 2014 02:32
-
-
Save drobbins/44a6d4355e5d7edff6a6 to your computer and use it in GitHub Desktop.
StringifyStream
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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