huffman-simple

0.0.2 • Public • Published

Huffman-simple

Simple huffman coding implementation in Node.js Uses 281 code as escape char

Available at https://www.npmjs.com/package/huffman-simple

Usage

npm install huffman-simple

To encode a string:

const huffman = require('huffman-simple');

// convert to an array of ints
const arr = [...'<your string>'].map(char=>char.charCodeAt(0));
const encoded = huffman.encode(arr);
const decoded = huffman.decode(encoded);
const str = String.fromCharCode(...decoded);

Bugs

breaks for many cases: '9-qf;l1g4asr' 'qqqqqqqqqq'

Package Sidebar

Install

npm i huffman-simple

Weekly Downloads

2

Version

0.0.2

License

MIT

Unpacked Size

6.68 kB

Total Files

5

Last publish

Collaborators

  • cguo5520