@kafkaman-labs/kafkajs-lz4
v0.0.1
Published
LZ4 compression codec for JS.
Downloads
9
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 'kafkaman-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;