RawCodec
Defined in: packages/codecs/src/raw-codec.ts:31
RawCodec - Standard pass-through. Returns a single Buffer.
⚠️ WARNING: For large payloads (100MB+), this codec WILL allocate memory
to concatenate chunks. Use RawChunksCodec for large files!
Example
Section titled “Example”const codec = new RawCodec();
// Serializeconst payload = codec.serialize(Buffer.from('data'));
// Deserializeconst data = codec.deserialize(payload);Implements
Section titled “Implements”Codec<Buffer,Buffer>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new RawCodec():
RawCodec
Returns
Section titled “Returns”RawCodec
Properties
Section titled “Properties”
readonlyname:"raw"="raw"
Defined in: packages/codecs/src/raw-codec.ts:32
Human-readable codec name for debugging/logging.
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”deserialize()
Section titled “deserialize()”deserialize(
buffer):Buffer
Defined in: packages/codecs/src/raw-codec.ts:41
Deserialize from a single merged buffer.
⚠️ WARNING: If called for large payloads, this implies a memory copy happened earlier (chunks were merged).
Parameters
Section titled “Parameters”buffer
Section titled “buffer”Buffer
Binary data to deserialize
Returns
Section titled “Returns”Buffer
Deserialized data
Implementation of
Section titled “Implementation of”deserializeChunks()
Section titled “deserializeChunks()”deserializeChunks(
chunks):Buffer
Defined in: packages/codecs/src/raw-codec.ts:49
⚠️ PERFORMANCE WARNING: This performs Buffer.concat()! For large payloads, consider using RawChunksCodec instead.
Parameters
Section titled “Parameters”chunks
Section titled “chunks”readonly Buffer<ArrayBufferLike>[]
Returns
Section titled “Returns”Buffer
Implementation of
Section titled “Implementation of”serialize()
Section titled “serialize()”serialize(
data):Buffer
Defined in: packages/codecs/src/raw-codec.ts:34
Serialize data to binary format.
Parameters
Section titled “Parameters”Buffer
Data to serialize
Returns
Section titled “Returns”Buffer
Binary representation as Buffer