Kit
Functions

getU32Decoder

getU32Decoder(config): FixedSizeDecoder<number, 4>

Returns a decoder for 32-bit unsigned integers (u32).

This decoder deserializes u32 values from four bytes in little-endian format by default. You may specify big-endian storage using the endian option.

For more details, see getU32Codec.

Parameters

ParameterTypeDescription
configNumberCodecConfigOptional settings for endianness.

Returns

FixedSizeDecoder<number, 4>

A FixedSizeDecoder<number, 4> for decoding u32 values.

Example

Decoding a u32 value.

const decoder = getU32Decoder();
const value = decoder.decode(new Uint8Array([0x2a, 0x00, 0x00, 0x00])); // 42

See

getU32Codec

On this page