0.2.0 • Published 10 years ago

simple-jsonstream v0.2.0

Weekly downloads
3
License
MIT
Repository
github
Last release
10 years ago

simple-jsonstream

A simple transform stream to output a valid JSON array

Need to output a stream of objects as a JSON array?

var JSONStream = require('simple-jsonstream');

var jsonStream = myAwesomeObjectStream.pipe(new JSONStream());

// In hapi route handler
reply(jsonStream).type('application/json');

// In express
res.setHeader('content-type', 'application/json');
jsonStream.pipe(res);

Acknowledgements:

This approach was mostly borrowed from a gist by @nlf