Node.js bindings for the Intel Storage Acceleration Library (ISA-L), providing high-performance compression and decompression for GZIP, DEFLATE, and ZLIB formats.
I built this largely with the help of claude-code.
npm install isal-nodeThe package automatically detects your platform and either:
- Uses a pre-built binary (no compilation needed)
- Falls back to building from source (if no pre-built binary available)
- macOS ARM64 (Apple Silicon)
- Linux x86_64 (Intel/AMD 64-bit)
- Linux ARM64 (ARM 64-bit)
If no pre-built binary is available, the package will build from source. You'll need:
- Rust toolchain (
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh) - Build tools for your platform:
- macOS: Xcode command line tools (
xcode-select --install) - Linux: build-essential package (
sudo apt-get install build-essential) - Windows: Visual Studio Build Tools or Visual Studio Community
- macOS: Xcode command line tools (
const isal = require('isal-node');
// Simple compression/decompression
const data = Buffer.from('Hello, World!');
// GZIP (Node.js zlib compatible)
const gzipped = isal.gzip(data);
const ungzipped = isal.gunzip(gzipped);
// DEFLATE (Node.js zlib compatible)
const deflated = isal.deflate(data);
const inflated = isal.inflate(deflated);
// With Sync suffix (Node.js zlib compatible)
const gzippedSync = isal.gzipSync(data);
const ungzippedSync = isal.gunzipSync(gzippedSync);
// ZLIB (additional formats)
const compressed = isal.compress(data);
const decompressed = isal.decompress(compressed);const isal = require('isal-node');
async function compressData() {
const data = Buffer.from('Hello, World!');
// GZIP (Node.js zlib compatible naming)
const gzipped = await isal.gzipAsync(data);
const ungzipped = await isal.gunzipAsync(gzipped);
// DEFLATE (Node.js zlib compatible naming)
const deflated = await isal.deflateAsync(data);
const inflated = await isal.inflateAsync(deflated);
// ZLIB (additional formats)
const compressed = await isal.compressAsync(data);
const decompressed = await isal.decompressAsync(compressed);
}
// Parallel compression for better performance
async function compressMultiple(dataArray) {
const promises = dataArray.map(data => isal.gzipAsync(data));
const compressed = await Promise.all(promises);
return compressed;
}Sync:
gzip(input, options?)- Compress using GZIPgunzip(input)- Decompress GZIP datadeflate(input, options?)- Compress using DEFLATEinflate(input)- Decompress DEFLATE datagzipSync(input, options?)- Compress using GZIP (explicit sync)gunzipSync(input)- Decompress GZIP data (explicit sync)deflateSync(input, options?)- Compress using DEFLATE (explicit sync)inflateSync(input)- Decompress DEFLATE data (explicit sync)
Async:
gzipAsync(input, options?)- Compress using GZIP (async)gunzipAsync(input)- Decompress GZIP data (async)deflateAsync(input, options?)- Compress using DEFLATE (async)inflateAsync(input)- Decompress DEFLATE data (async)
Additional Formats:
compress(input, options?)- Compress using ZLIBdecompress(input)- Decompress ZLIB datacompressAsync(input, options?)- Compress using ZLIB (async)decompressAsync(input)- Decompress ZLIB data (async)
level- Compression level (0, 1, or 3). Default: 3- 0: No compression (fastest)
- 1: Fast compression
- 3: Best compression
npm install
npm run buildnpm test # Run synchronous tests
npm run test:async # Run asynchronous tests
npm run test:all # Run all testsRun benchmarks to compare performance against Node.js built-in zlib:
npm run benchmark- Full benchmark with multiple data sizes and typesnpm run benchmark:quick- Quick benchmark with smaller data setsnpm run benchmark:async- Async vs sync performance comparison
MIT