Skip to content

String Compression

Mac McMeans edited this page Feb 23, 2019 · 15 revisions

The localDataStorage utility incorporates SMAZ (a simple string compression library written in C) created by Salvatore Sanfilippo (https://github.com/antirez/smaz) under a BSD license. The derivative work included in this project (a javascript port of C code), was written by personalcomputer (https://github.com/personalcomputer/smaz.js), under the same BSD license.

The compression logic is suitable for crunching very short strings, but does not work well for general purpose data. It can compress text by 40-50% on average, with English text providing superior results, and even strings of two or three bytes can be optimized for space.

localStorage Keys

The usual suspects:

set / get      clear      key      remove

The esoteric ones:

Array Keys:
push / pull, pullall      poke      contains      where

Broadcasting:
broadcast

Bypass:
forceset / forceget

Data Transfer:
import / export

Duplicates:
countdupes, showdupes, listdupes

Internals:
cancrunch      crunch / uncrunch

shufflestring / unshufflestring

xorstring

Management:
keys

Memory Consumption:

Memory Quota:
showquota

Query:
haskey, hasval, hastype

Security:
safeset / safeget

setscramblekey / getscramblekey

Type Check:
isarray      isbigint      isboolean      iscrunch

isdate      isfloat      isinteger      isnull

isnumber      isobject      isstring

showtype

Utility:
chopget      copy      softset      rename

Properties:

channel      length      quota      version

Settings:

verbosity

Memory Keys

Standard:

_set / _get      _clear      _key      _remove

Unconventional:

Data Sync:
_backup / _restore

Management:
_keys

Security:
_safeset / _safeget

Type Check:
_isarray      _isbigint      _isboolean      _iscrunch

_isdate      _isfloat      _isinteger      _isnull

_isnumber      _isobject      _isstring

_showtype

Utility:
_chopget      _copy      _softset      _rename

Clone this wiki locally