Skip to content

Variable: decode()

ts
const decode: <T>(base64: string) => T;

Decodes a compressed base64 string back into a value

Type Parameters

Type ParameterDefault type
T extends EncodableEncodable

Parameters

ParameterTypeDescription
base64stringThe compressed base64 string representing an encoded value

Returns

T

The decoded value

Throws

@nhtio/encoder/exceptions!E_NOT_AN_ENCODED_VALUE | E_NOT_AN_ENCODED_VALUE When the provided string is not a valid encoded value

Throws

@nhtio/encoder/exceptions!E_INVALID_VERSION | E_INVALID_VERSION When the encoded value has an invalid version

Throws

@nhtio/encoder/exceptions!E_INCOMPATIBLE_VERSION | E_INCOMPATIBLE_VERSION When the encoded value is from a version that is newer than the decoder version

Throws

@nhtio/encoder/exceptions!E_UNDECODABLE_VALUE | E_UNDECODABLE_VALUE When the encoded value cannot be decoded