Skip to content

Lossless LZW compression/decompression implemented in JavaScript for strings/JSON/JS objects.

License

Notifications You must be signed in to change notification settings

floydpink/lzwCompress.js

Repository files navigation

npm CircleCI Appveyor Travis Coverage Status codecov FOSSA Status

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

MIT License

FOSSA Status

Other Libraries

For use in Angular 1.X projects, check out the angular-lzwcompress module