{"_id":"lzw-async","_rev":"9-3e708b1e0978d9ef04936096bbcfa8f4","name":"lzw-async","description":"Asynchronous implementation of Lempel-Ziv-Welch (LZW) compression.","dist-tags":{"latest":"0.1.3"},"versions":{"0.1.1":{"name":"lzw-async","description":"Asynchronous implementation of Lempel-Ziv-Welch (LZW) compression.","version":"0.1.1","author":{"name":"hiddentao"},"licenses":[{"type":"mit","url":"https://github.com/hiddentao/lzw-async/blob/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/hiddentao/lzw-async.git"},"engine":["node >=0.1.102"],"main":"./lzw-async.js","_npmJsonOpts":{"file":"/home/ram/.npm/lzw-async/0.1.1/package/package.json","wscript":false,"contributors":false,"serverjs":false},"_id":"lzw-async@0.1.1","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.14","_nodeVersion":"v0.5.0-pre","_defaultsLoaded":true,"dist":{"shasum":"ea60b44041a63529b1c9d6e7c731a144b5a2a883","tarball":"https://registry.npmjs.org/lzw-async/-/lzw-async-0.1.1.tgz","integrity":"sha512-jcf1OlFkFqTppruMvsbHTAzLA0IpHzFk0OftK1NqDt/CejZz76SSacaq7b3WkMT4mRh/Z3negV+7V8uOAkXGjg==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAV8FDfHQn7RdCE75lffUbin/C+inLjs7+FiQK987f/NAiB8j2oKvBB9tauTNGu3BzVI/6AXUshjLszACWQOIsUQ0A=="}]},"scripts":{},"maintainers":[{"name":"hiddentao","email":"ram@hiddentao.com"}]},"0.1.2":{"name":"lzw-async","description":"Asynchronous implementation of Lempel-Ziv-Welch (LZW) compression.","version":"0.1.2","author":{"name":"Ramesh Nair","email":"ram@hiddentao.com","url":"http://www.hiddentao.com/"},"contributors":[{"name":"Ramesh Nair","email":"ram@hiddentao.com","url":"http://www.hiddentao.com/"}],"keywords":["compression","lzw","async"],"licenses":[{"type":"mit","url":"https://github.com/hiddentao/lzw-async/blob/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/hiddentao/lzw-async.git"},"engine":["node >= 0.1.102"],"main":"./lzw-async.js","_npmUser":{"name":"hiddentao","email":"ram@hiddentao.com"},"_id":"lzw-async@0.1.2","dependencies":{},"devDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.0.105","_nodeVersion":"v0.6.1","_defaultsLoaded":true,"dist":{"shasum":"32299cc91e2ae128b813369f0dea42d7438d15bb","tarball":"https://registry.npmjs.org/lzw-async/-/lzw-async-0.1.2.tgz","integrity":"sha512-ElS3iW59PbP3FhesrFSSxQi67ctp0VuGhn/8vAnGCDT8DNSOyPh78XMp/8GK3/sahH05O3XGBjKRmoxhmWSlXQ==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDltyj62wCiQFt3RegBoWKc70PG+cWoOtZpN86tchlgcgIgB6PR40YwoNfOV4Z8btbLW+ni91N4qRbA3IJSgT0LzkQ="}]},"maintainers":[{"name":"hiddentao","email":"ram@hiddentao.com"}]},"0.1.3":{"name":"lzw-async","description":"Asynchronous implementation of Lempel-Ziv-Welch (LZW) compression.","version":"0.1.3","author":{"name":"Ramesh Nair","email":"ram@hiddentao.com","url":"http://www.hiddentao.com/"},"contributors":[{"name":"Ramesh Nair","email":"ram@hiddentao.com","url":"http://www.hiddentao.com/"}],"keywords":["compression","lzw","async"],"licenses":[{"type":"mit","url":"https://github.com/hiddentao/lzw-async/blob/master/LICENSE"}],"repository":{"type":"git","url":"git://github.com/hiddentao/lzw-async.git"},"engine":["node >= 0.1.102"],"main":"./lzw-async.js","_npmUser":{"name":"hiddentao","email":"ram@hiddentao.com"},"_id":"lzw-async@0.1.3","dependencies":{},"devDependencies":{},"optionalDependencies":{},"engines":{"node":"*"},"_engineSupported":true,"_npmVersion":"1.1.1","_nodeVersion":"v0.6.11","_defaultsLoaded":true,"dist":{"shasum":"51c5642492175991afb4d6cb4a37483d64d65569","tarball":"https://registry.npmjs.org/lzw-async/-/lzw-async-0.1.3.tgz","integrity":"sha512-gY3OKC0NC74bVyBGaq0AgIa2YbHt8da7fmJlKQYE3yhFkY17f2hkoXhQpDai9zkRoTfhkDC0aQC/50LlQCoxig==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIGCN90aJ7WPUrKG1qZXwnj//TWeEz2RDMPFMPM4CqZv2AiBvTzKlaAsfeDwgWnr4m4L919Ka1L+lhMKCUFxmCP8NgA=="}]},"readme":"# Asynchronous Javascript implementation of LZW algorithm.\n\nThis is an efficient asynchronous implementation of the Lempel-Ziv-Welch (LZW) compression algorithm in Javascript.\n\n## Features\n\n* Input can contain any character from the full ASCII set (i.e. the first 256 Unicode characters).\n* Runs asynchronously (both compression and decompression) and provides progress updates every 0.5 seconds.\n* Supports use of a custom dictionary where input character range is known in advance. This helps to reduce compressed\nsize.\n* Compression dictionary uses binary search tree to speed up lookups.\n* Variable-length output encoding (i.e. using the minimum no. of bits necessary) for better compression ratios.\n* Automated tests as well as manual testing facility (see `index.html`).\n* Passes [Javascript Lint](http://www.javascriptlint.com/).\n* Available for node.js via [npm](http://npmjs.org/).\n\nMinified library size is only ~4KB (~2KB when gzipped).\n\n## Install for browser\n\nThe **index.html** file included contains a testing form for the algorithm as well as automated tests based\non predefined data which is good at catching boundary case errors.\n\nTo use the algorithm in your own projects include the **lzw-async.js** file using a `script` tag:\n\n    <script type=\"text/javascript\" src=\"lzw-async.min.js\"></script>\n\n\n## Install for node.js\n\nTo use with node.js install the module:\n\n    $ npm install lzw-async\n\n\n## Examples\n\nTo compress call:\n\n    LZWAsync.compress({\n            input : \"rawtext\",\n            output : function(output) {\n                console.log(output);\n            }\n    });\n\nTo decompress call:\n\n    LZWAsync.decompress({\n            input : \"compressedtext\",\n            output : function(output) {\n                console.log(output);\n            }\n    });\n\n\nTo receive progress updates:\n\n    LZWAsync.compress({\n            input : \"rawtext\",\n            output : function(output) {\n                console.log(output);\n            },\n            progress: function (percent) {\n                console.log(percent + \" % done\");\n            }\n    });\n\nIf you already know which characters will appear in the raw input then you can tell LZWAsync to restrict the\ndictionary to only those characters, thereby improving the compression ratio:\n\n    LZWAsync.compress({\n            input : \"rawtext\",\n            output : function(output) {\n                console.log(output);\n            },\n            dict: 'abcdefghijklmnopqrstuvwxyz'\n    });\n\n**Note:** be sure to pass in the same dictionary value when decompressing in order to get the original input back.\n\n\n\n## API\n\nThere are two methods provided within the **LZWAsync** namespace:\n\n* **compress**\n  * Compress an input string consisting of ASCII characters.\n\n* **decompress**\n  * Decompresss an input string compressed using `compress`.\n\nEach method takes a single dictionary parameter which can contain the following entries:\n\n* `input`\n  * **Required**. This is the input string.\n* `output`\n  * **Required**. A callback function with the signature `function(result)`. This gets called with the resulting output\n  once the compression/decompression is finished.\n* `progress`\n  * Optional. A callback function with the signature `function(percent)`. This gets called every a half second\n  with a progress update.\n* `dict`\n  * Optional. A string consisting of all the characters that can be expected in the `input`. This may allow the\n  algorithm to initialize a smaller dictionary and thus enable better compression ratios.\n\n\n## Known limitations and future work\n\nAt the moment the compressor only accepts ASCII (upto 256) characters even though Javascript supports UTF-16 characters in its strings. For now, unless you can specify your required characters in the `dict` parameter, you should base64-encode your input prior to compression if it contains non-latin script. By base64 encoding you'll also be able to pass in a more limited dictionary character list and thereby gain greater compression ratios.\n\nThere are also dictionary optimisations which can be made to decrease the amount of memory used by the dictionary though speed will be impacted as a result.\n\n## Useful resources\n\nThe following resources where enormously helpful:\n\n* http://rosettacode.org/wiki/LZW_compression#JavaScript\n* http://warp.povusers.org/EfficientLZW/index.html\n* http://marklomas.net/ch-egg/articles/lzwjs.htm\n* http://michael.dipperstein.com/lzw/\n\n\n---\nDeveloped by [Ramesh Nair](http://www.hiddentao.com/). Originally released July 2011.\n\n* Blog post: [Link](http://www.hiddentao.com/archives/2011/08/01/asynchronous-implementation-of-lzw-algorithm-in-javascript/).\n* Source code: [Github](https://github.com/hiddentao/lzw-async.js).\n\n\n","maintainers":[{"name":"hiddentao","email":"ram@hiddentao.com"}]}},"maintainers":[{"name":"hiddentao","email":"ram@hiddentao.com"}],"time":{"modified":"2022-06-19T14:56:24.156Z","created":"2011-10-10T15:16:56.778Z","0.1.1":"2011-10-10T15:16:57.512Z","0.1.2":"2011-12-20T17:30:17.803Z","0.1.3":"2012-05-19T15:10:16.625Z"},"author":{"name":"Ramesh Nair","email":"ram@hiddentao.com","url":"http://www.hiddentao.com/"},"repository":{"type":"git","url":"git://github.com/hiddentao/lzw-async.git"}}