kafka-ts
Version:
**KafkaTS** is a Apache Kafka client library for Node.js. It provides both a low-level API for communicating directly with the Apache Kafka cluster and high-level APIs for publishing and subscribing to Kafka topics.
31 lines (30 loc) • 1.27 kB
TypeScript
export declare class Encoder {
private buffer;
private offset;
constructor(initialCapacity?: number);
private ensure;
getBufferLength(): number;
write(src: Buffer): this;
writeEncoder(other: Encoder): this;
writeInt8(value: number): this;
writeInt16(value: number): this;
writeInt32(value: number): this;
writeUInt32(value: number): this;
writeInt64(value: bigint): this;
writeUVarInt(value: number): this;
writeVarInt(value: number): this;
writeUVarLong(value: bigint): this;
writeVarLong(value: bigint): this;
writeString(value: string | null): this;
writeCompactString(value: string | null): this;
writeVarIntString(value: string | null): this;
writeUUID(value: string | null): this;
writeBoolean(value: boolean): this;
writeArray<T>(arr: T[] | null, callback: (encoder: Encoder, item: T) => void): this;
writeCompactArray<T>(arr: T[] | null, callback: (encoder: Encoder, item: T) => void): this;
writeVarIntArray<T>(arr: T[], callback: (encoder: Encoder, item: T) => void): this;
writeBytes(value: Buffer | null): this;
writeCompactBytes(value: Buffer | null): this;
writeTagBuffer(tags?: Record<number, Buffer>): this;
value(): Buffer<ArrayBufferLike>;
}