addEncoderSentinel

Call Signature

function addEncoderSentinel<TFrom>(
    encoder,
    sentinel,
): FixedSizeEncoder<TFrom>;

Creates an encoder that writes a Uint8Array sentinel after the encoded value. This is useful to delimit the encoded value when being read by a decoder.

See addCodecSentinel for more information.

Type Parameters

Type ParameterDescription
TFromThe type of the value to encode.

Parameters

ParameterType
encoderFixedSizeEncoder<TFrom>
sentinelReadonlyUint8Array

Returns

FixedSizeEncoder<TFrom>

See

addCodecSentinel

Call Signature

function addEncoderSentinel<TFrom>(
    encoder,
    sentinel,
): VariableSizeEncoder<TFrom>;

Creates an encoder that writes a Uint8Array sentinel after the encoded value. This is useful to delimit the encoded value when being read by a decoder.

See addCodecSentinel for more information.

Type Parameters

Type ParameterDescription
TFromThe type of the value to encode.

Parameters

ParameterType
encoderEncoder<TFrom>
sentinelReadonlyUint8Array

Returns

VariableSizeEncoder<TFrom>

See

addCodecSentinel

On this page