A module for compressing and decompressing JSON data using Gzip compression algorithm and HPack compression algorithm.
npm install json-pack-gzipA module for compressing and decompressing JSON data using Gzip compression algorithm and HPack compression algorithm.
Use the package manager npm to install json-pack-gzip.
``bash`
npm install json-pack-gzipUsage
`javascript
const jsonPackGzip = require('json-pack-gzip');
// Compress JSON data
const compressedData = jsonPackGzip.compress(jsonObject);
// Decompress JSON data
const decompressedData = jsonPackGzip.decompress(jsonBuffer);
// Calculate byte length of data
const byteLength = jsonPackGzip.calculateSize(data);
`
Compresses a JSON object using Gzip compression algorithm. The input JSON object is first packed into a homogeneous array and then stringified before compression.
- `jsonObject`(Array): The JSON object to be compressed.`
- debug`(Boolean): options for debugging, defaults to false.
Returns a compressed data as a Buffer object.
- `jsonBuffer` (Buffer): The Buffer object to be decompressed.`
- debug`(Boolean): options for debugging, defaults to false.
Returns a decompressed and unpacked JSON object as a list of objects.
- `data`` (String|Buffer|Object|Array): The data to be size-calculated.
Returns the byte length of the input data.
Pull requests are welcome. For major changes, please open an issue first
to discuss what you would like to change.
Please make sure to update tests as appropriate.
This module is licensed under the MIT License