charlike
Version:
Small, fast, simple and streaming project scaffolder for myself, but not only. Supports hundreds of template engines through the @JSTransformers API or if you want custom `render` function passed through options
19 lines (12 loc) • 353 B
JavaScript
const JSONStream = require('./')
const stream = JSONStream.parse('data.*')
stream.on('data', (row) => {
console.log(row) // this never gets called, the stream closes immediately
})
stream.write('{"data":')
stream.write('[')
stream.write('{"count": 1},')
stream.write('{"count": 2},')
stream.write('{"count": 3}')
stream.write(']}')
stream.end()