tiny-lzw.js - LZW Codec for tinyJS

tiny-lzw.js packs a LZW-Codec into the Object t.zip, containing the Methods .enc(ode) and .dec(ode).

Download

tiny-lzw.js [625b] - tiny-lzw-min.js.gz [307b]

Hint

The t.zip-Codec requires only tiny.js. Other scripts are not necessary.

Usage

The Methods .enc and .dec take a string as argument and return the LZW en- re decoded string.

Example

(function() {
    function test() {
        var data=t('#testinput').v(), to=t.zip.enc(data), l=data.length, L=l+1, i=0;
        t('#to').h(to+' &#160; <b>'+((to.length*100/data.length)|0)+'%</b>');
        t('#re').h(t.zip.dec(to));
    }
    t('#test').e('mousedown', test);
})();