lzbase62
LZ77(LZSS) based compression algorithm in base62 for JavaScript.
The compressed result will be a string in base 62 (0-9A-Za-z) characters.
Installation
In a browser:
<script src="lzbase62.js"></script>
or
<script src="lzbase62.min.js"></script>
The object named "lzbase62" will defined in the global scope.
In Node.js:
npm install lzbase62
var lzbase62 = require('lzbase62');
Usage
{string} lzbase62.compress ( {string} data )
Compress data to a base 62(0-9a-zA-Z) encoded string.
@param {string} data Input data
@return {string} Compressed data{string} lzbase62.decompress ( {string} data )
Decompress data from a base 62(0-9a-zA-Z) encoded string.
@param {string} data Input data
@return {string} Decompressed data
var data = 'hello hello hello';
var compressed = lzbase62.compress(data);
console.log(compressed); // sBpBwBwBzB9GAM
var decompressed = lzbase62.decompress(data);
console.log(decompressed.length < data.length); // true
console.log(decompressed === data); // true
Demo
License
MIT