Skip to content

decodeWithCodec

decodeWithCodec(instance, binary, mediaType): Promise<unknown>

Defined in: astrobase/src/codecs/codecs.ts:68

Decodes binary data using the Codec for the media type, plus Middlewares, provided by the instance.

Instance

The instance that provides the Codec & Middlewares.

Uint8Array

The binary data to decode.

MediaTypeLike

The media type of the data.

Promise<unknown>

A promise that resolves with the decoded data. As we cannot anticipate how registered middleware will behave, the type of the output will be unknown. You will need to assert the output type yourself.