/** * Encodes a string into a Uint8Array, prepending the length of the string as a variable-length integer and optionally compressing it. */ declare class LengthPrefixedTextEncoder { private readonly encoder; private readonly compression; private readonly lengthEncoder; constructor(compression?: 'gzip' | 'deflate' | 'deflate-raw' | null); /** * Encodes the given string into a Uint8Array. * * @param data The string to encode. * @returns A Uint8Array containing the length-prefixed and optionally compressed encoded string. * @throws {RangeError} If the string length exceeds the maximum representable value. */ encode(data: string): Uint8Array; private compress; } /** * Decodes a stream of Uint8Arrays into strings, where each string * is prefixed by its length as a variable-length integer and optionally decompressed. */ declare class LengthPrefixedTextDecoder { private readonly decoder; private readonly compression; private readonly lengthDecoder; private buffer; private expectedLength; private offset; private lengthPrefixLength; constructor(compression?: 'gzip' | 'deflate' | 'deflate-raw' | null); /** * Decodes a Uint8Array into a list of strings. * * @param data The Uint8Array to decode. * @returns An array of decoded strings. */ decode(data: Uint8Array): string[]; /** * Reads the length prefix from the beginning of the data. * * @param data The Uint8Array containing the length prefix. * @returns The length of the message, or null if there's not enough data to read the length. */ private readLength; private decompress; } export { LengthPrefixedTextEncoder, LengthPrefixedTextDecoder };