Skip to content

jgranstrom/zipson-stream

Repository files navigation

zipson-stream

Build Status npm version dependencies Status devDependencies Status

zipson-stream adds node stream support to zipson, a JSON.parse/stringify alternative with added compression.

Try zipson with the online demo


Installing

npm install --save zipson-stream

API

stringifyStream(data, options?)

Stringify data to a zipson stream. Compression options can be provided according to zipson documentation

import { stringifyStream } from 'zipson-stream';
// const { stringifyStream } = require('zipson-stream');

const myData = [1, 2, 3, 4 ,5];
const stream = stringifyStream(myData, options);
stream.pipe(process.stdout);
parseStream(stream)

Parse a zipson stream, resolves with the parsed data when the stream ends.

import { parseStream } from 'zipson-stream';
// const { parseStream } = require('zipson-stream');

parseStream(myStringifiedStream)
.then(parsedData => {
  console.log(parsedData);
});

Running the tests

npm test

For running tests in watch mode while developing:

npm run testw

Contributing

Pull requests are welcome. Please see the conventional commits guidelines for commit message formatting.

Versioning

This project is versioned using SemVer See tags and CHANGELOG.md for version details.

License

This project is licensed under the MIT License - see LICENSE.md file for details