Smart.Framework Logo

static class ArchLzs
{ } .

CLASS :: LZS Archive
Compress or Decompress a LZS archive
This is very slow with large strings ... extremely slow !!!
This is why the max (hardcoded) length of the string it can compress/decompress is 4096 bytes
The purpose of this class is to compress/decompress cookies that can be shared also with PHP
The PHP version of this class is available in modules/mod-js-components/libs/ArchLzs.php
LZS Archiver for JavaScript :: compress on-the-fly a string using only Javascript with the LZS algorithm


class Methods

public static function compressToBase64 ( {String} input ) {} . {String}
@return: {String} The compressed string LZS + Base64
@param: {String} input The original string to be compressed
Compress a string to LZS + Base64
public static function decompressFromBase64 ( {String} input ) {} . {String}
@return: {String} The uncompressed (original) string
@param: {String} input The LZS + Base64 compressed string
Decompress from Base64 + LZS

class Properties


class Constants


Sample code: JavaScript


var plainStr = 'Some String'; var archivedStr = ArchLzs.compressToBase64(plainStr); var unArchivedStr = ArchLzs.decompressFromBase64(archivedStr); if(plainStr !== unArchivedStr) { alert('Javascript LZS Archiver Failed: Plain String is different after Archive/Unarchive operations !'); } console.log(plainStr, archivedStr, unArchivedStr);


documentation generated on: 2023-10-19 23:19:06 +0000


Smart.Framework © 2009-2023 unix-world.org