@matschik/lz-string
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

@matschik/lz-string

This is a modern port of the original lz-string.

What does modern means?

The project was not really supported and maintained anymore.

I rewrote it in modern javascript syntax, typescript, compiled it with esbuild and wrote tests with uvu.

The size is much smaller and it play nicer with modern bundlers.

Install

$ npm install @matschik/lz-string

Example

import { compress, decompress } from '@matschik/lz-string'

const compressed = compress('hello world')
const decompressed = decompress(compressed)

API

The API is the same as lz-string, minus a few methods that needs re-implementations:

  • compressToUTF16(input: string): string;
  • decompressFromUTF16(compressed: string): string;
  • compressToUint8Array(uncompressed: string): Uint8Array;
  • decompressFromUint8Array(compressed: Uint8Array): string;

compressToBase64(input: string): string;

decompressFromBase64(input: string): string | null;

compressToURL(input: string): string;

decompressFromURL(input: string): string | null;

compress(uncompressed: string): string;

decompress(compressed: null | string): string | null;

Readme

Keywords

Package Sidebar

Install

npm i @matschik/lz-string

Weekly Downloads

13

Version

0.0.2

License

MIT

Unpacked Size

19.5 kB

Total Files

5

Last publish

Collaborators

  • matschik