lz4-kafkajs
v1.0.0
Published
LZ4 streaming compression and decompression library for KafkaJS
Downloads
10,016
Maintainers
Readme
lz4-kafkajs
TypeScript-ready lz4 compression codec for KafkaJS.
ℹ️ Requires Node v10 or above to work.
Install
With yarn
$ yarn add lz4-kafkajs
With npm
$ npm install lz4-kafkajs
Usage
import { CompressionTypes, CompressionCodecs } from "kafkajs";
import LZ4 from "lz4-kafkajs";
CompressionCodecs[CompressionTypes.LZ4] = new LZ4().codec;
Options
All options are passed on to the lz4 library.
Example
To configure the decompression and compression:
import LZ4, {
CompressOptions,
DecompressOptions,
LZ4Options,
} from "lz4-kafkajs";
const decompressOptions: DecompressOptions = {
useJS: false,
};
const compressOptions: CompressOptions = {
blockChecksum: false,
blockIndependence: true,
blockMaxSize: 4 << 20,
dict: false,
dictId: 0,
highCompression: false,
streamChecksum: true,
streamSize: false,
};
const options: LZ4Options = {
decompressOptions,
compressOptions,
};
CompressionCodecs[CompressionTypes.LZ4] = new LZ4(options).codec;