huffy
v1.2.0
Published
A tiny compression library based on Huffman coding.
Downloads
9
Maintainers
Readme
Huffy
A tiny compression library based on Huffman coding.
Install
npm install --save huffy
Usage
import {compress, decompress} from 'huffy';
const str = 'some string to compress, it works better with longer things'.repeat ( 10 );
const buffer = new TextEncoder ().encode ( str );
const compressed = compress ( buffer );
const decompressed = decompress ( compressed );
console.log ( 'Compression ratio:', compressed.length / buffer.length );
License
MIT © Fabio Spampinato