Skip to content

Function: decode()

ts
function 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

E_NOT_AN_ENCODED_VALUE When the provided string is not a valid encoded value

Throws

E_INVALID_VERSION When the encoded value has an invalid version

Throws

E_INCOMPATIBLE_VERSION When the encoded value is from a version that is newer than the decoder version

Throws

E_UNDECODABLE_VALUE When the encoded value cannot be decoded