
Research
NPM targeted by malware campaign mimicking familiar library names
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
json-pack-gzip
Advanced tools
A module for compressing and decompressing JSON data using Gzip compression algorithm and HPack compression algorithm.
A 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.
npm install json-pack-gzip
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);
compress(jsonObject, debug = false)
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.
decompress(jsonBuffer, debug = false)
Decompresses a Buffer object to a JSON object using Gzip decompression algorithm. The decompressed data is first parsed from a homogeneous array into a list of objects.
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.
calculateSize(data)
Calculates the byte length of the input data. It supports data types: String, Buffer, Array, and Object. For non-buffer objects, the function first stringifies them before calculating the size.
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
FAQs
A module for compressing and decompressing JSON data using Gzip compression algorithm and HPack compression algorithm.
The npm package json-pack-gzip receives a total of 10 weekly downloads. As such, json-pack-gzip popularity was classified as not popular.
We found that json-pack-gzip demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Socket uncovered npm malware campaign mimicking popular Node.js libraries and packages from other ecosystems; packages steal data and execute remote code.
Research
Socket's research uncovers three dangerous Go modules that contain obfuscated disk-wiping malware, threatening complete data loss.
Research
Socket uncovers malicious packages on PyPI using Gmail's SMTP protocol for command and control (C2) to exfiltrate data and execute commands.