Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/nisaacson/json-stringify-stream

Transform stream to stringify a readable stream of objects into json strings
https://github.com/nisaacson/json-stringify-stream

Last synced: about 1 month ago
JSON representation

Transform stream to stringify a readable stream of objects into json strings

Awesome Lists containing this project

README

        

# JSON StringifyStream

Stringify readable stream of objects into json strings

[![NPM](https://nodei.co/npm/json-stringify-stream.png)](https://nodei.co/npm/json-stringify-stream/)

[![Build Status](https://travis-ci.org/nisaacson/json-stringify-stream.png)](https://travis-ci.org/nisaacson/json-stringify-stream)
[![Dependency Status](https://david-dm.org/nisaacson/json-stringify-stream/status.png)](https://david-dm.org/nisaacson/json-stringify-stream)
[![Code Climate](https://codeclimate.com/github/nisaacson/json-stringify-stream.png)](https://codeclimate.com/github/nisaacson/json-stringify-stream)

# Installation
```bash
npm install -S json-stringify-stream
```

# Usage

Create an instance of Stringify and pipe a readable stream of objects into that instance

```javascript
var StringifyStream = require('json-stringify-stream')
// stringify is an instance of require('stream').Transform
var stringify = new StringifyStream()

var readStream = {} // a stream of single objects
var stringify = readStream.pipe(splitter)
stringify.on('data', function(chunk) {
console.dir(chunk) // json string
})
stringify.on('finish', function() {
console.log('finish event called, all objects stringified')
})
```