lzwcompress
v1.1.0
Published
Lossless LZW compression/decompression implemented in JavaScript for strings/JSON/JS objects.
Downloads
11,578
Maintainers
Readme
lzwCompress.js
Lossless LZW compression/decompression implemented in JavaScript for strings/JSON/JS objects.
Usage:
Install lzwCompress from npm:
npm install lzwcompress
And then to use it in your node.js applications:
import lzwCompress from 'lzwcompress';
const json = {
name: 'Mr. JavaScript Kumar',
age: 42,
start_date: new Date(),
address: {
street: '123 MG Road',
city: 'Mumbai',
state: 'Maharashtra',
country: 'India'
}
};
// to compress objects
const compressed = lzwCompress.pack(json);
// to uncomress
const original = lzwCompress.unpack(compressed);
console.log(original);
Applies LZW compression and JSON key optimization and makes JSON (or any javascript object) smaller for local storage, to ship up to the server etc.
License
Other Libraries
For use in Angular 1.X projects, check out the angular-lzwcompress module