huffy
TypeScript icon, indicating that this package has built-in type declarations

1.2.0 • Public • Published

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

Package Sidebar

Install

npm i huffy

Weekly Downloads

7

Version

1.2.0

License

none

Unpacked Size

32.6 kB

Total Files

34

Last publish

Collaborators

  • fabiospampinato