Skip to content

Function: encode()

ts
function encode<T>(what: T): string;

Encodes a value into a compressed base64 string

Type Parameters

Type ParameterDefault type
T extends EncodableEncodable

Parameters

ParameterTypeDescription
whatTThe value to be encoded

Returns

string

A compressed base64 string representing the encoded value

Throws

E_ENCODING_FAILED When the value cannot be encoded

Throws

E_CIRCULAR_REFERENCE When the value contains dangerous circular references

Throws

E_UNENCODABLE_VALUE When the value contains unencodable data types