Variables
getBaseXEncoder
const
getBaseXEncoder: (alphabet
) =>VariableSizeEncoder
<string
>
Returns an encoder for base-X encoded strings.
This encoder serializes strings using a custom alphabet, treating the length of the alphabet as the base. The encoding process involves converting the input string to a numeric value in base-X, then encoding that value into bytes while preserving leading zeroes.
For more details, see getBaseXCodec.
Parameters
Parameter | Type | Description |
---|---|---|
alphabet | string | The set of characters defining the base-X encoding. |
Returns
VariableSizeEncoder
<string
>
A VariableSizeEncoder<string>
for encoding base-X strings.
Example
Encoding a base-X string using a custom alphabet.