codecDeserialize
codecDeserialize<
T>(codec,frame):T
Defined in: packages/codecs/src/types.ts:89
Helper to deserialize using codec, preferring chunks if available.
This function automatically chooses the most efficient deserialization path:
- If codec has
deserializeChunks, use it (zero-copy potential) - Otherwise, merge payload and use
deserialize
Type Parameters
Section titled “Type Parameters”T
Parameters
Section titled “Parameters”Codec<unknown, T>
payload
Section titled “payload”Buffer
payloadChunks
Section titled “payloadChunks”readonly Buffer<ArrayBufferLike>[]
Returns
Section titled “Returns”T
Example
Section titled “Example”const frame = frameBuffer.push(chunk)[0];const data = codecDeserialize(myCodec, frame);