/** * Encode data to MessagePack binary format * @param data - Any serializable data * @returns MessagePack encoded binary data */ export declare function encode(data: any): Uint8Array; /** * Decode MessagePack binary data * @param data - MessagePack binary data * @returns Decoded data */ export declare function decode(data: Uint8Array): T; /** Minimum byteLength for a binary value to be extracted out-of-band. */ export declare const BINARY_EXTRACT_THRESHOLD = 16384; /** Envelope and out-of-band segments of a CUIB frame, not yet assembled. */ export interface FrameParts { envelope: Uint8Array; segments: Uint8Array[]; /** Byte size of the assembled frame */ size: number; } /** * Encode a message for the wire. Large binaries (>= BINARY_EXTRACT_THRESHOLD) * are extracted into out-of-band segments after the msgpack envelope; * binary-free messages stay byte-identical to encode(). */ export declare function encodeMessage(data: any): Uint8Array; /** Assemble the CUIB frame of `parts` into a new buffer. */ export declare function assembleFrame(parts: FrameParts): Uint8Array; /** * encodeMessage without the final copy: plain msgpack bytes for a message * without large binaries, otherwise the parts of its CUIB frame. */ export declare function encodeMessageParts(data: any): Uint8Array | FrameParts; /** Write the CUIB frame of `parts` into `out` at `offset` (parts.size bytes). */ export declare function writeFrame(parts: FrameParts, out: Uint8Array, offset: number): void; /** Byte size of the CUIB header and envelope of `parts`, the frame without its segments. */ export declare function frameHeadSize(parts: FrameParts): number; /** * Write the CUIB header and envelope of `parts` into `out` at `offset` * (frameHeadSize bytes). Returns the offset where the segments follow. */ export declare function writeFrameHead(parts: FrameParts, out: Uint8Array, offset: number): number; /** * Decode a wire message. Payloads without the CUIB magic are plain msgpack. * For framed payloads the placeholder maps are replaced by zero-copy * Uint8Array subarray views into `data`. In Node every binary comes back as * a Buffer view, also when `data` is a plain Uint8Array (a message split * across socket reads, a reassembled chunked one). */ export declare function decodeMessage(data: Uint8Array): T;