@arexico/kafkajs-zstd
v0.1.2
Published
A KafkaJS codec for ZStandard compression using Bun's built-in zstd (forked from @kafkajs/zstd)
Maintainers
Readme
@arexico/kafkajs-zstd
ZStandard codec for KafkaJS using Bun's built-in zstd compression.
Fork Notice: This is a fork of
@kafkajs/zstdthat has been ported to use Bun's native zstd compression instead of thecppzstnative module.
NOTE: This codec requires Bun v1.2.14 or higher with built-in zstd compression APIs (
Bun.zstdCompressandBun.zstdDecompress).This package is provided on a best-effort basis. Original repository: @kafkajs/zstd
Installation
npm install --save @arexico/kafkajs-zstdConfiguration
const { CompressionTypes, CompressionCodecs } = require('kafkajs')
const ZstdCodec = require('@arexico/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.
{
/*
* Higher compression level means better compression ratio at the cost of speed.
* See https://facebook.github.io/zstd/
*/
level: 3
}decompressionParams
Optional Currently unused but kept for API compatibility.
Testing
Requirements: This package requires Bun v1.2.14 or higher with zstd support.
# Run with Docker (for integration tests)
$ docker-compose up -d && node scripts/waitForKafka.js
$ bun test
# Run unit tests only (no Docker required)
$ bun test src/compression.spec.js
# Verify type definitions
$ npm run test:types
# Lint
$ npm run lintLicense
See LICENSE for more details.
