lzw

Lempel–Ziv–Welch data compression algorithm

npm install lzw
8 downloads in the last week
14 downloads in the last month

Info

Library for compress/extend base on Lempel–Ziv–Welch data compression algorithm

Example



var util = require("util");
var assert = require("assert");

var lzw = require("../lzw");

var original = "ababababababababababababab";
assert(original.length > 0);

var compressed = lzw.compress(original);
assert(compressed.length > 0);

var obtained = lzw.extend(compressed);
assert.equal(original.length, obtained.length);
assert.equal(original, obtained.toString());

console.log(util.format("%s bytes -> %s bytes -> %s bytes", original.length, compressed.length, obtained.length));

console.log("original: " + original);
console.log("obtained: " + obtained.toString());
npm loves you