How to use the lz-string/libs/lz-string.compressToUTF16 function in lz-string

To help you get started, we’ve selected a few lz-string examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github johannesjo / super-productivity / src / app / core / compression / lz.worker.ts View on Github external
function handleData(msgData) {
  switch (msgData.type) {
    case 'COMPRESS':
      return LZString.compress(msgData.strToHandle);
    case 'DECOMPRESS':
      return LZString.decompress(msgData.strToHandle);
    case 'COMPRESS_UTF16':
      // tslint:disable-next-line
      return LZString['compressToUTF16'](msgData.strToHandle);
    case 'DECOMPRESS_UTF16':
      // tslint:disable-next-line
      return LZString['decompressFromUTF16'](msgData.strToHandle);
  }
}
github softvar / secure-ls / src / index.js View on Github external
encodedData = AES.encrypt(jsonData, this.utils.encryptionSecret);
      } else if (this._isDES) {
        encodedData = DES.encrypt(jsonData, this.utils.encryptionSecret);
      } else if (this._isRabbit) {
        encodedData = RABBIT.encrypt(jsonData, this.utils.encryptionSecret);
      } else if (this._isRC4) {
        encodedData = RC4.encrypt(jsonData, this.utils.encryptionSecret);
      }

      encodedData = encodedData && encodedData.toString();
    }

    // Compress data if set to true
    compressedData = encodedData;
    if (this._isCompression || isAllKeysData) {
      compressedData = LZString.compressToUTF16(encodedData);
    }

    return compressedData;
  };