ChemPal Documentation - v1.6.0
    Preparing search index...

    Module utils/storage

    Functions - Utils

    isLzEnvelope

    Type-guard: returns true if value is an LzEnvelope.

    encodeValue

    JSON-stringifies and LZ-compresses a value, returning an LzEnvelope. When useStorageCompression is false in config.json, the value is stored as-is (no compression). If serialization fails (e.g. circular structures) the original value is returned untouched and an error is logged.

    decodeValue

    Decodes a value read from chrome.storage. If the value is an LzEnvelope, it is decompressed and JSON-parsed; otherwise the value is returned unchanged (backward-compatible passthrough for legacy data).

    encodeItems

    Encodes every value of an items map for chrome.storage.X.set.

    decodeItems

    Decodes every value of an items map returned from chrome.storage.X.get. Tolerates mixed compressed and legacy entries (used by full-scan reads such as chrome.storage.local.get(null)).

    decodeChanges

    Decodes the oldValue / newValue of every change in a chrome.storage.onChanged payload.

    Interfaces - Utils

    LzEnvelope

    Envelope wrapping a compressed JSON payload. Detected on read via isLzEnvelope.

    Modules

    <internal>

    Type Aliases - Utils

    ChangedListener

    Listener registered by callers of cstorage.onChanged.addListener.

    Variables - Utils

    LZ_VERSION

    Wire-format version. Bumped if the envelope shape ever changes.

    cstorage

    Compression-aware wrapper around chrome.storage. Use exactly like chrome.storage.local / chrome.storage.session, but values are transparently LZ-compressed at rest.