# @xingrz/cppzst

> Zstd binding for Nodejs, with TypeScript support.

Latest version **2.1.0-alpha.8** (published 2021-11-11) · MIT license · 0 weekly downloads

## Install

```sh
npm install @xingrz/cppzst
pnpm add @xingrz/cppzst
yarn add @xingrz/cppzst
bun add @xingrz/cppzst
```

## Health

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

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support; large bundle.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.1.0-alpha.8 |
| Published | 2021-11-11 |
| First published | 2021-11-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 18.4 MB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 7 |
| Author | zwb-ict |
| Maintainers | xingrz |
| Keywords | zstd, compression, decompression |

## Links

- npm: https://www.npmjs.com/package/@xingrz/cppzst
- Repository: https://github.com/xingrz/cppzst
- Homepage: https://github.com/xingrz/cppzst#readme
- Issues: https://github.com/xingrz/cppzst/issues
- npm.io page: https://npm.io/package/@xingrz/cppzst

## Dependencies (3)

- [nan](https://npm.io/package/nan.md) ^2.14.2
- [pond](https://npm.io/package/pond.md) ^2.1.2
- [node-gyp-build](https://npm.io/package/node-gyp-build.md) ^4.3.0

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 2.1.0-alpha.8 (latest) — 2021-11-11
- 2.1.0-alpha.7 — 2021-11-11
- 2.1.0-alpha.6 — 2021-11-03
- 2.1.0-alpha.5 — 2021-11-03
- 2.1.0-alpha.3 — 2021-11-02
- 2.1.0-alpha.2 — 2021-11-02
- 2.1.0-alpha.1 — 2021-11-02
- 2.1.0-alpha.0 — 2021-11-02

## README

@xingrz/cppzst [![test](https://github.com/xingrz/cppzst/actions/workflows/test.yml/badge.svg)](https://github.com/xingrz/cppzst/actions/workflows/test.yml)
=====

[![][npm-version]][npm-url] [![][npm-downloads]][npm-url] [![license][license-img]][license-url] [![issues][issues-img]][issues-url] [![stars][stars-img]][stars-url] [![commits][commits-img]][commits-url]

Zstd binding for Nodejs, with TypeScript support.

## Installation

```sh
$ npm install @xingrz/cppzst --save
```

## Usage

### Async

#### compress(buffer[, zstdCompressParams])

```ts
import { compress } from '@xingrz/cppzst';

try {
  const output = await compress(input);
} catch(err) {
  // ...
}
```

#### decompress(buffer[, zstdDecompressParams])

```ts
import { decompress } from '@xingrz/cppzst';

try {
  const output = await decompress(input);
} catch(err) {
  // ...
}
```

### Sync

#### compressSync(buffer[, zstdCompressParams])

```ts
import { compressSync } from '@xingrz/cppzst';

try {
  const output = compressSync(input);
} catch(err) {
  // ...
}
```

#### decompressSync(buffer[, zstdCompressParams])

```ts
import { decompressSync } from '@xingrz/cppzst';

try {
  const output = decompressSync(input);
} catch(err) {
  // ...
}
```

### Stream

#### compressStream([zstdCompressParams])

```ts
import { compressStream } from '@xingrz/cppzst';
import { createReadStream, createWriteStream } from 'fs';

createReadStream('path/to/input')
  .pipe(compressStream())
  .pipe(createWriteStream('path/to/output'));
```

#### decompressStream([zstdCompressParams])

```ts
import { decompressStream } from '@xingrz/cppzst';
import { createReadStream, createWriteStream } from 'fs';

createReadStream('path/to/input')
  .pipe(decompressStream())
  .pipe(createWriteStream('path/to/output'));
```

### ZSTD Params

The `compress`, `compressSync` and `compressStream` methods may accept an optional `zstdCompressParams` object to define compress level and/or dict.

```ts
const zstdCompressParams = {
  level: 5, // default 1
  dict: new Buffer('hello zstd'), // if dict null, left level only.
  dictSize: dict.length,  // if dict null, left level only.
};
```

The `decompress`, `decompressSync` and `decompressStream` methods may accept an optional `zstdDecompressParams` object to define dict.

```ts
const zdtdDecompressParams = {
  dict: new Buffer('hello zstd'),
  dictSize: dict.length,
};
```

## Tests

```sh
$ npm test
```

## License
MIT

[npm-version]: https://img.shields.io/npm/v/@xingrz/cppzst.svg?style=flat-square
[npm-downloads]: https://img.shields.io/npm/dm/@xingrz/cppzst.svg?style=flat-square
[npm-url]: https://www.npmjs.org/package/@xingrz/cppzst
[license-img]: https://img.shields.io/github/license/xingrz/cppzst?style=flat-square
[license-url]: LICENSE
[issues-img]: https://img.shields.io/github/issues/xingrz/cppzst?style=flat-square
[issues-url]: https://github.com/xingrz/cppzst/issues
[stars-img]: https://img.shields.io/github/stars/xingrz/cppzst?style=flat-square
[stars-url]: https://github.com/xingrz/cppzst/stargazers
[commits-img]: https://img.shields.io/github/last-commit/xingrz/cppzst?style=flat-square
[commits-url]: https://github.com/xingrz/cppzst/commits/master

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