Functions
getBytesCodec
getBytesCodec():
VariableSizeCodec
<Uint8Array
<ArrayBufferLike
> |ReadonlyUint8Array
,ReadonlyUint8Array
>
Returns a codec for encoding and decoding raw byte arrays.
This codec serializes and deserializes byte arrays without modification.
The size of the encoded and decoded byte array is determined dynamically. This means, when reading, the codec will consume all remaining bytes in the input.
- To enforce a fixed size, consider using fixCodecSize.
- To add a size prefix, use addCodecSizePrefix.
- To add a sentinel value, use addCodecSentinel.
Returns
VariableSizeCodec
<Uint8Array
<ArrayBufferLike
> | ReadonlyUint8Array
, ReadonlyUint8Array
>
A VariableSizeCodec<ReadonlyUint8Array | Uint8Array, ReadonlyUint8Array>
.
Example
Encoding and decoding a byte array.
Remarks
Separate getBytesEncoder and getBytesDecoder functions are available.