All Projects → antoniomuso → lz4-napi

antoniomuso / lz4-napi

Licence: MIT License
Fastest lz4 compression library in Node.js, powered by napi-rs and lz4-flex.

Programming Languages

javascript
184084 projects - #8 most used programming language
typescript
32286 projects
rust
11053 projects
shell
77523 projects

Projects that are alternatives of or similar to lz4-napi

snappy
Fastest Snappy compression library in Node.js
Stars: ✭ 110 (+279.31%)
Mutual labels:  compression, napi, node-api, napi-rs
Lz4
Extremely Fast Compression algorithm
Stars: ✭ 6,623 (+22737.93%)
Mutual labels:  compression, lz4
EasyCompressor
⚡ A compression library that implements many compression algorithms such as LZ4, Zstd, LZMA, Snappy, Brotli, GZip, and Deflate. It helps you to improve performance by reducing Memory Usage and Network Traffic for caching.
Stars: ✭ 167 (+475.86%)
Mutual labels:  compression, lz4
Dandere2x
Dandere2x - Fast Waifu2x Video Upscaling.
Stars: ✭ 723 (+2393.1%)
Mutual labels:  fast, compression
Lizard
Lizard (formerly LZ5) is an efficient compressor with very fast decompression. It achieves compression ratio that is comparable to zip/zlib and zstd/brotli (at low and medium compression levels) at decompression speed of 1000 MB/s and faster.
Stars: ✭ 408 (+1306.9%)
Mutual labels:  fast, compression
smallz4
Optimal LZ4 compression
Stars: ✭ 24 (-17.24%)
Mutual labels:  compression, lz4
Httpteleport
Transfer 10Gbps http traffic over 1Gbps networks :)
Stars: ✭ 422 (+1355.17%)
Mutual labels:  fast, compression
napi.zig
tiny and fast napi bindings for zig
Stars: ✭ 53 (+82.76%)
Mutual labels:  bindings, napi
lz4ultra
Optimal LZ4 compressor, that produces files that decompress faster while keeping the best compression ratio
Stars: ✭ 49 (+68.97%)
Mutual labels:  compression, lz4
py-lz4framed
LZ4-frame library for Python (via C bindings)
Stars: ✭ 42 (+44.83%)
Mutual labels:  compression, lz4
C Blosc
A blocking, shuffling and loss-less compression library that can be faster than `memcpy()`.
Stars: ✭ 742 (+2458.62%)
Mutual labels:  fast, compression
tiny
compress data for better performance
Stars: ✭ 21 (-27.59%)
Mutual labels:  compression, lz4
blz4
Example of LZ4 compression with optimal parsing using BriefLZ algorithms
Stars: ✭ 24 (-17.24%)
Mutual labels:  compression, lz4
pyrus-cramjam
Thin Python wrapper to de/compression algorithms in Rust - lightweight & no dependencies
Stars: ✭ 40 (+37.93%)
Mutual labels:  compression, lz4
pmod
Native cross platform library with language projection support for native code.
Stars: ✭ 22 (-24.14%)
Mutual labels:  bindings
Ccache.cmake
🚅 Compile faster with Ccache! A Ccache integration for CMake with Xcode support.
Stars: ✭ 24 (-17.24%)
Mutual labels:  fast
node-janus
https://wiki.mozilla.org/Mobile/Janus
Stars: ✭ 58 (+100%)
Mutual labels:  compression
rc-zip
Pure rust zip & zip64 reading and writing
Stars: ✭ 93 (+220.69%)
Mutual labels:  compression
pakkero
Pakkero is a binary packer written in Go made for fun and educational purpose. Its main goal is to take in input a program file (elf binary, script, even appimage) and compress it, protect it from tampering and intrusion.
Stars: ✭ 143 (+393.1%)
Mutual labels:  compression
zopflipy
A Python bindings for Zopfli
Stars: ✭ 17 (-41.38%)
Mutual labels:  compression

lz4-napi

Node.js NAPI Binding for LZ4 compression algorithm, powered by Rust napi-rs and lz4-flex.

Pros:

  • Fast! ⚡️
  • Memory Safe! 🔒
  • Uses libuv's threadpool! 🧵

Table of content

Installation

npm i lz4-napi
# OR
yarn add lz4-napi

Usage

Compress

const { readFile } = require('fs/promises');
const { compress } = require('lz4-napi');

// if you support top-level await
const buffer = await readFile("./bigFile.dat");
const compressedBuffer = await compress(buffer)
// Store compressed buffer somewhere

Uncompress

const { uncompress } = require('lz4-napi');

// if you support top-level await
const compressedBuffer = await getFromSomeStorage();
const uncompressedBuffer = await uncompress(compressedBuffer)
// Do something with compressedBuffer!

APIs

Promise

compress

(data: Buffer | string | ArrayBuffer | Uint8Array) => Promise<Buffer>

uncompress

(data: Buffer | ArrayBuffer | Uint8Array) => Promise<Buffer>

Sync

compressSync

(data: Buffer | string | ArrayBuffer | Uint8Array) => Buffer

uncompressSync

(data: Buffer | ArrayBuffer | Uint8Array) => Buffer

Performance

Hardware

Benchmarks runs on the following hardware:

  • Processor Name: i9 9900K
  • Total Number of Cores: 8
  • Hyper-Threading Technology: Enabled
  • Memory: 32 GB

Benchmark

Running "Compress" suite...
Progress: 100%

  lz4:
    911 ops/s, ±18.64%     | 54.68% slower

  snappy:
    2 010 ops/s, ±19.23%   | fastest

  gzip:
    78 ops/s, ±18.76%      | 96.12% slower

  deflate:
    118 ops/s, ±20.42%     | 94.13% slower

  brotli:
    6 ops/s, ±0.21%       | slowest, 99.7% slower

Finished 5 cases!
  Fastest: snappy
  Slowest: brotli
Running "Decompress" suite...
Progress: 100%

  lz4:
    9 425 ops/s, ±12.50%   | fastest

  snappy:
    3 900 ops/s, ±13.39%   | 58.62% slower

  gzip:
    823 ops/s, ±20.48%     | slowest, 91.27% slower

  deflate:
    1 350 ops/s, ±12.52%   | 85.68% slower

  brotli:
    979 ops/s, ±11.55%     | 89.61% slower

Finished 5 cases!
  Fastest: lz4
  Slowest: gzip
Done in 61.20s.

Contributing

Project is pretty simple and straight forward for what is my needs, but if you have any idea you're welcome.

This projects uses conventional commit so be sure to use standard commit format or PR won't be accepted

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'feat(scope): some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

Acknowledgments

License

Distributed under the MIT License. See LICENSE for more information.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].