Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/amoutonbrady/lz-string
https://github.com/amoutonbrady/lz-string
Last synced: about 21 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/amoutonbrady/lz-string
- Owner: amoutonbrady
- Created: 2021-01-25T22:03:15.000Z (almost 4 years ago)
- Default Branch: main
- Last Pushed: 2023-03-10T16:11:44.000Z (over 1 year ago)
- Last Synced: 2024-11-03T07:02:20.745Z (4 days ago)
- Language: TypeScript
- Size: 30.3 KB
- Stars: 10
- Watchers: 1
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# @amoutonbrady/lz-string
This is a modern port of the original [lz-string](https://github.com/pieroxy/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](https://esbuild.github.io/) and wrote tests with [uvu](https://github.com/lukeed/uvu).
The size is much smaller and it play nicer with modern bundlers.
## Install
```bash
$ npm install @amoutonbrady/lz-string
```## Example
```js
import { compress, decompress } from '@amoutonbrady/lz-string'const compressed = compress('hello world')
const decompressed = decompress(compressed)
```## API
The API is the same as [lz-string](https://github.com/pieroxy/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;