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

https://github.com/anzerr/json.stream

Pipe a stream of grouped JSON objects emits split parsable JSON buffers
https://github.com/anzerr/json.stream

json nodejs stream util

Last synced: 2 months ago
JSON representation

Pipe a stream of grouped JSON objects emits split parsable JSON buffers

Awesome Lists containing this project

README

          

### `Intro`
![GitHub Actions status | publish](https://github.com/anzerr/json.stream/workflows/publish/badge.svg)

Split a streamed json into parsable chunks.

#### `Install`
``` bash
npm install --save git+https://github.com/anzerr/json.stream.git
npm install --save @anzerr/json.stream
```

### `Example`
``` javascript
const {JsonStream, Parser} = require('json.stream');

let s = new JsonStream();

s.on('data', (chunk) => {
console.log(JSON.parse(chunk.toString()));
});

let p = new Parser();
console.log(p.push('{"cat":1}{"cat":2}{"cat":3}').process());

s.write('{"cat":1}{"cat":2}{"cat":3}');
```