open-index/open-npm huggingface dataset:
npm package: @kafkajs/zstd
Description: A KafkaJS codec for ZStandard compression
Author: Tommy Brunn
Latest version: 0.1.1

# `@kafkajs/zstd`

ZStandard codec for KafkaJS.

> **NOTE**: This codec relies on [cppzst](https://www.npmjs.com/package/cppzst) for compression and decompression. Please divert any issues with cppzst there, and only open issues on this repo in case the version being used here needs to be updated.
>
> This package is provided on a best-effort basis. See [#2](https://github.com/kafkajs/zstd/issues/2)

## Installation

```sh
npm install --save @kafkajs/zstd
```

## Configuration

```javascript
const {  CompressionTypes, CompressionCodecs } = require('kafkajs')
const ZstdCodec = require('@kafkajs/zstd')

// Both compressionParams and decompressionParams are optional
const compressionParams = { level: 1 }
const decompressionParams = {}
CompressionCodecs[CompressionTypes.ZSTD] = ZstdCodec(compressionParams, decompressionParams)
```

### `compressionParams`

**Optional** Allows you to configure the compression level and training data.

```js
{
    /*  
     * Higher compression level means faster at the cost of compression ratio or memory usage.
     * See https://facebook.github.io/zstd/
     */
    level: 3,

    /*
     * Training data for improving performance on small payloads.
     * See https://facebook.github.io/zstd/#small-data
     */
    dict: trainingData,
    dictSize: Buffer.byteLength(trainingData)
}
```

### `decompressionParams`

**Optional** Allows you to configure the training data.

```js
{
    /*
     * Training data for improving performance on small payloads.
     * See https://facebook.github.io/zstd/#small-data
     */
    dict: trainingData,
    dictSize: Buffer.byteLength(trainingData)
}
```

## Testing

```sh
$ docker-compose up -d && node scripts/waitForKafka.js
$ npm test

# Interactive mode
$ npm run test:watch

# Verify type definitions
$ npm run test:types

# Lint
$ npm run lint
```

## License

See [LICENSE](https://github.com/kafkajs/zstd/blob/master/LICENSE) for more details.
npm package: @kafkaman-labs/kafkajs-lz4
Description: LZ4 compression codec for JS.
Author: Kafkaman
Latest version: 0.0.1

# kafkajs-lz4

[![Build Status](https://img.shields.io/github/workflow/status/indix/kafkajs-lz4/Test?logo=github-actions&longCache=true&style=flat-square)](https://travis-ci.org/indix/kafkajs-lz4) [![NPM Version](https://img.shields.io/npm/v/kafkajs-lz4.svg?longCache=true&style=flat-square)](https://www.npmjs.com/package/kafkajs-lz4) ![](https://img.shields.io/badge/typescript-4.1-blue.svg?longCache=true&style=flat-square)

TypeScript-ready [lz4](https://www.npmjs.com/package/lz4) compression codec for [KafkaJS](https://www.npmjs.com/package/kafkajs).

ℹ️ Requires Node v10 or above to work.

## Install

```bash
$ yarn add kafkajs-lz4
```

## Usage

```typescript
import { CompressionTypes, CompressionCodecs } from 'kafkajs';
import LZ4Codec from 'kafkaman-kafkajs-lz4';

CompressionCodecs[CompressionTypes.LZ4] = new LZ4Codec().codec;
```

## Options

All options are transparently passed on to the [lz4-asm library's compress options](https://www.npmjs.com/package/lz4-asm#lz4compresssource-options).

### Example

To set the highest level of compression for your Kafka messages —

```typescript
const lz4Codec = new LZ4Codec({
    preferences: {
        compressionLevel: 16
    }
}).codec;

CompressionCodecs[CompressionTypes.LZ4] = lz4Codec;
```