# @eonasdan/lz-string

> Compress and decompress string with javascript.

Latest version **1.0.3** (published 2022-07-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install @eonasdan/lz-string
pnpm add @eonasdan/lz-string
yarn add @eonasdan/lz-string
bun add @eonasdan/lz-string
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-07-23 |
| First published | 2022-07-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 58.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jonathan Peterson |
| Maintainers | eonasdan |

## Links

- npm: https://www.npmjs.com/package/@eonasdan/lz-string
- Repository: https://github.com/Eonasdan/lz-string
- Homepage: https://github.com/Eonasdan/lz-string#readme
- Issues: https://github.com/Eonasdan/lz-string/issues
- npm.io page: https://npm.io/package/@eonasdan/lz-string

## Recent versions

- 1.0.3 (latest) — 2022-07-23

## README

# String Compression

I forked [matschik version](https://github.com/matschik/lz-string) which is a port of the original [lz-string](https://github.com/pieroxy/lz-string).

I reduced the redundant code and used rollup to produce both an ES6+ and UMD scripts

## Install

```bash
$ npm install @eonasdan/lz-string
```

## Example

```js
import { compress, decompress } from '@eonasdan/lz-string'

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

## API

### 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;

---
_Source: https://npm.io/package/@eonasdan/lz-string · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
