![Introducing Enhanced Alert Actions and Triage Functionality](https://cdn.sanity.io/images/cgdhsj6q/production/fe71306d515f85de6139b46745ea7180362324f0-2530x946.png?w=800&fit=max&auto=format)
Product
Introducing Enhanced Alert Actions and Triage Functionality
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
zlib
Advanced tools
Package description
The zlib npm package provides compression and decompression functionalities using the zlib library, which is a part of Node.js core. It allows you to compress and decompress data streams and buffers using various algorithms like gzip, deflate, and more.
Compression using gzip
This code demonstrates how to compress a file using gzip. It reads from 'input.txt' and writes the compressed data to 'input.txt.gz'.
const zlib = require('zlib');
const fs = require('fs');
const input = fs.createReadStream('input.txt');
const output = fs.createWriteStream('input.txt.gz');
input.pipe(zlib.createGzip()).pipe(output);
Decompression using gzip
This code demonstrates how to decompress a gzip file. It reads from 'input.txt.gz' and writes the decompressed data to 'input.txt'.
const zlib = require('zlib');
const fs = require('fs');
const input = fs.createReadStream('input.txt.gz');
const output = fs.createWriteStream('input.txt');
input.pipe(zlib.createGunzip()).pipe(output);
Compression using deflate
This code demonstrates how to compress a file using deflate. It reads from 'input.txt' and writes the compressed data to 'input.txt.deflate'.
const zlib = require('zlib');
const fs = require('fs');
const input = fs.createReadStream('input.txt');
const output = fs.createWriteStream('input.txt.deflate');
input.pipe(zlib.createDeflate()).pipe(output);
Decompression using deflate
This code demonstrates how to decompress a deflate file. It reads from 'input.txt.deflate' and writes the decompressed data to 'input.txt'.
const zlib = require('zlib');
const fs = require('fs');
const input = fs.createReadStream('input.txt.deflate');
const output = fs.createWriteStream('input.txt');
input.pipe(zlib.createInflate()).pipe(output);
Pako is a fast zlib port to JavaScript, mostly used for client-side compression and decompression. It provides similar functionalities to zlib but is designed to work in the browser as well as in Node.js.
node-lz4 is a Node.js binding for the LZ4 compression library. It offers high-speed compression and decompression, making it a good alternative to zlib for scenarios where performance is critical.
Snappy is a fast compression and decompression library developed by Google. The node-snappy package provides Node.js bindings for Snappy, offering an alternative to zlib with a focus on speed over compression ratio.
Readme
node-zlib - Simple, synchronous deflate/inflate for node.js buffers.
Install with npm install zlib
.
var Buffer = require('buffer').Buffer;
var zlib = require('zlib');
var input = new Buffer('lorem ipsum dolor sit amet');
var compressed = zlib.deflate(input);
var output = zlib.inflate(compressed);
Note that node-zlib
is only intended for small (< 128 KB) data that you already have buffered. It is not meant for input/output streams.
Make sure you have zlib
installed. Mac OS X ships with it by default.
To obtain and build the bindings:
git clone git://github.com/kkaefer/node-zlib.git
cd node-zlib
./configure
make
You can also use npm
to download and install them:
npm install zlib
expresso is required to run unit tests.
npm install expresso
make test
node-zlib
is BSD licensed.
FAQs
Simple, synchronous deflate/inflate for buffers
The npm package zlib receives a total of 269,488 weekly downloads. As such, zlib popularity was classified as popular.
We found that zlib demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 5 open source maintainers 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.
Product
Socket now supports four distinct alert actions instead of the previous two, and alert triaging allows users to override the actions taken for all individual alerts.
Security News
Polyfill.io has been serving malware for months via its CDN, after the project's open source maintainer sold the service to a company based in China.
Security News
OpenSSF is warning open source maintainers to stay vigilant against reputation farming on GitHub, where users artificially inflate their status by manipulating interactions on closed issues and PRs.