kafkajs-lz4
v2.0.0-beta.0
Published
LZ4 compression codec for the KafkaJS library
Downloads
78,007
Maintainers
Readme
kafkajs-lz4
TypeScript-ready lz4 compression codec for KafkaJS.
ℹ️ Requires Node v10 or above to work.
Install
$ yarn add kafkajs-lz4
Usage
import { CompressionTypes, CompressionCodecs } from 'kafkajs';
import LZ4Codec from 'kafkajs-lz4';
CompressionCodecs[CompressionTypes.LZ4] = new LZ4Codec().codec;
Options
All options are transparently passed on to the lz4-asm library's compress options.
Example
To set the highest level of compression for your Kafka messages —
const lz4Codec = new LZ4Codec({
preferences: {
compressionLevel: 16
}
}).codec;
CompressionCodecs[CompressionTypes.LZ4] = lz4Codec;