LZMA-JS ES6 + 类型
这是一个E6模块,其中包含类型定义 LZMA - JS (法语) 软件包由 内森·鲁格,然后通过 上田川启藤。 。 。 .
LZMA-JS是Lempel-Ziv-Markov(LZMA)链压缩算法的JavaScript执行. 请在原始的 README 中找到详细信息 : https://github.com/LZMA-JS/LZMA-JS 页面存档备份,存于互联网档案馆
安装
安装国家防范机制或雅恩.
npm install @blu3r4y/lzma
yarn add @blu3r4y/lzma
使用量
压缩并解压一串有压缩一级.
import { compress, decompress } from "@blu3r4y/lzma";
const data = "Hello World!";
const compressed = compress(data, 1);
const decompressed = decompress(result);
// data === decompressed
您也可以使用回调接口或提供字节数组.
界面与原包相同.
function compress(data: string | Uint8Array, mode: Mode);
function compress(
data: string | Uint8Array,
mode: Mode,
on_finish: (result: Uint8Array, error: any) => void,
on_progress?: (percent: number) => void
);
function decompress(data: Uint8Array);
function decompress(
data: Uint8Array,
on_finish: (result: string | Uint8Array, error: any) => void,
on_progress?: (percent: number) => void
);