0.1.0 • Published 6 years ago

lznext v0.1.0

Weekly downloads
33
License
MIT
Repository
github
Last release
6 years ago

lzString

LZ-based compression algorithm for JavaScript.

Note: This is a forked library of Pieroxy's lz-string library.

The library works in the same manner as Pieroxy's lz-string, except that this is a UMD build. The original library supported cjs, angular and requirejs. This on the other hand does not support angular. If you want to use it with angular, please continue reading below or click on the link above to download the original library instead.

This library comes with bug fixes which are not part of original library yet. If you still find any issues please feel free to log them.

install

$ npm install -g lznext

cjs:

const LZString = require('lznext');

es6:

import LZString from 'lznext';

es5:

<script src="lzString.min.js"></script>
<script>
LZString.compress('Hello World');
</script>

angular 1:

angular.module('LZString', []).factory('LZString', () => LZString);

Usage

Compress:

LZString.compress('Hello World'); // Output: 〶惶@✰ӈ

De-compress:

LZstring.decompress('〶惶@✰ӈ'); // Output: Hello World

Local Storage friendly:

LZString.compressToUTF16('Hello World'); // Output: ɢ䰭䰾怤ݴ䂼怩䠠 

De-compress:

LZstring.decompressFromUTF16('ɢ䰭䰾怤ݴ䂼怩䠠 '); // Output: Hello World

For more details on available methods, please refer to the original documentation.