Kit
Functions

getBytesDecoder

getBytesDecoder(): VariableSizeDecoder<ReadonlyUint8Array>

Returns a decoder for raw byte arrays.

This decoder reads byte arrays exactly as provided without modification.

The decoded byte array extends from the provided offset to the end of the input.

For more details, see getBytesCodec.

Returns

VariableSizeDecoder<ReadonlyUint8Array>

A VariableSizeDecoder<ReadonlyUint8Array>.

Example

Decoding a byte array as-is.

const decoder = getBytesDecoder();
 
decoder.decode(new Uint8Array([1, 2, 3])); // Uint8Array([1, 2, 3])
decoder.decode(new Uint8Array([255, 0, 127])); // Uint8Array([255, 0, 127])

See

getBytesCodec

On this page