A simple JavaScript lib to compress, decompress and optimize json data exchange with GZIP and Base64. Inspired by https://github.com/tcorral/JSONC
Methods
(static) compress(obj, safeopt) → {string}
Compress data with GZIP to a final Base64 string
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
obj |
Object | string | Input data to compress |
||
safe |
boolean |
<optional> |
false
|
Should GZON protect existing keys from beign replaced if they can collide with replacement ones? Use this if you have keys to protect from replacement. |
Returns:
The final Base64 string of the JSON data
- Type
- string
(static) decompress(b64gzippedJSON, returnJSONStringopt) → {Object|string}
Decompress gzipped data
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
b64gzippedJSON |
string | The Base64 string of the gzipped JSON data |
||
returnJSONString |
boolean |
<optional> |
false
|
Should the returned value be a JSON string or a fully parsed object |
Returns:
The original input use at compression time
- Type
- Object | string