0.2.16 • Published 16 days ago

@cloudpss/zstd v0.2.16

Weekly downloads
-
License
MIT
Repository
github
Last release
16 days 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

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

const compressed = compress(Buffer.from('Hello World!'));
const decompressed = decompress(compressed);

console.log(decompressed.toString()); // 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

Notice: If you are using this library in a browser, the Buffer classes is replaced with Uint8Array classes.

compress(input: BinaryData, level?: number): Buffer

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

decompress(input: BinaryData): Buffer

Decompresses the input buffer.

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.2.16

16 days ago

0.2.15

2 months ago

0.2.14

5 months ago

0.2.12

6 months ago

0.2.10

7 months ago

0.2.9

8 months ago

0.2.7

1 year ago

0.2.6

1 year ago

0.2.5

1 year ago

0.2.4

1 year ago

0.2.3

1 year ago

0.2.2

1 year ago

0.2.0

1 year ago

0.1.8

1 year ago

0.1.7

1 year ago

0.1.6

1 year ago

0.1.4

1 year ago

0.1.2

1 year ago

0.1.0

1 year ago