0.3.2 • Published 9 months ago

@cloudpss/zstd v0.3.2

Weekly downloads
-
License
MIT
Repository
github
Last release
9 months ago

@cloudpss/zstd

check Codacy coverage Codacy Badge npm version

This is a pure esm package contains the zstd n-api addon for node.js & wasm for browsers.

Installation

npm install @cloudpss/zstd

Usage

Basic

import { compress, decompress } from '@cloudpss/zstd';

const compressed = await compress(new TextEncoder().encode('Hello World!'));
const decompressed = await decompress(compressed);

console.log(new TextDecoder().decode(decompressed)); // Hello World!

To explicitly use the wasm or the n-api version, import @cloudpss/zstd/wasm and @cloudpss/zstd/napi respectively.

API

Module @cloudpss/zstd / @cloudpss/zstd/wasm / @cloudpss/zstd/napi

compress(input: BinaryData | Blob, level?: number): Promise<Uint8Array> compressSync(input: BinaryData, level?: number): Uint8Array

Compresses the input data with the given compression level (default: 4).

decompress(input: BinaryData | Blob): Promise<Uint8Array> decompressSync(input: BinaryData): Uint8Array

Decompresses the input data.

TYPE: 'napi' | 'wasm'

The type of the current module.

ZSTD_VERSION(): string

The version of the zstd library.

Module @cloudpss/zstd/config

MAX_SIZE: number

The maximum size of the input/output buffer.

DEFAULT_LEVEL: number

The default compression level.

MIN_LEVEL: number

Minimum compression level.

MAX_LEVEL: number

Maximum compression level.

License

MIT

0.3.2

9 months ago

0.3.1-alpha.5

11 months ago

0.3.1

11 months ago

0.3.0

1 year ago

0.3.0-alpha.6

1 year ago

0.3.0-alpha.7

1 year ago

0.3.0-alpha.8

1 year ago

0.2.16

1 year ago

0.2.15

1 year ago

0.2.14

2 years ago

0.2.12

2 years ago

0.2.10

2 years ago

0.2.9

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.0

2 years ago

0.1.8

2 years ago

0.1.7

2 years ago

0.1.6

2 years ago

0.1.4

2 years ago

0.1.2

2 years ago

0.1.0

2 years ago