2023-04-13 00:28:14 +08:00
|
|
|
## @bytedo/gzip
|
2023-04-13 00:31:12 +08:00
|
|
|
> 浏览器端的gzip库, fork于[pako](https://github.com/nodeca/pako), 仅调整语法为esm, 并只保留gzip的导出。
|
2023-04-13 00:28:14 +08:00
|
|
|
|
2023-04-13 00:34:31 +08:00
|
|
|
### 版本同步状态:
|
|
|
|
|
|
|
|
pako: ![pako](https://img.shields.io/npm/v/pako.svg)
|
|
|
|
@bytedo/gzip: ![@bytedo/gzip](https://img.shields.io/npm/v/@bytedo/gzip.svg)
|
|
|
|
|
2023-04-13 00:28:14 +08:00
|
|
|
|
|
|
|
### 安装&使用
|
|
|
|
|
|
|
|
```bash
|
|
|
|
npm install @bytedo/gzip
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
或直接使用cdn地址:
|
|
|
|
|
|
|
|
```js
|
|
|
|
|
|
|
|
import { gzip , ungzip } from '@bytedo/gzip' // use importmap
|
|
|
|
// or
|
|
|
|
import { gzip , ungzip } from '//jscdn.ink/@bytedo/gzip/latest/index.js'
|
|
|
|
|
|
|
|
|
|
|
|
let res = gzip('hello world') // return Uint8Array object
|
|
|
|
|
2023-04-13 00:34:31 +08:00
|
|
|
let txt = ungzip(res) // return Uint8Array object
|
2023-04-13 00:28:14 +08:00
|
|
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
|
|
### 开源协议
|
|
|
|
|
|
|
|
- MIT - 除 `/lib/zlib` 目录以外的所有文件
|
|
|
|
- ZLIB - `/lib/zlib` 目录
|