glize/compressors

Members

(static, constant) TYPE :string

Enumeration of available compression types.
Source:
Type:
  • string

Methods

(static) compress(data, opt_typeopt) → {string}

Compress data string using specified compression type.
Source:
Parameters:
Name Type Attributes Default Description
data string Data to compress.
opt_type string <optional>
TYPE.LZW Optional compression type.
Returns:
Type:
string
Returns compressed data.
Example
const result = compress(
  'Any string of any length. Any string of any length. Any string of any length.');
console.log(result);
//> Any string of aā leĈth. ĀĂĄĆĈĊČĎĂđēĕėďĚćĉċčďġgĔ.

(static) decompress(data, opt_typeopt) → {string}

Decompress data string using specified compression type.
Source:
Parameters:
Name Type Attributes Default Description
data string Data to compress.
opt_type string <optional>
TYPE.LZW Optional compression type.
Returns:
Type:
string
Returns compressed data.
Example
const result = decompress('Any string of aā leĈth. ĀĂĄĆĈĊČĎĂđēĕėďĚćĉċčďġgĔ.');
console.log(result);
//> Any string of any length. Any string of any length. Any string of any length.