A function that, given a Uint8Array of bytes, can produce a string representation thereof. The function may optionally attempt to convert other input types to Uint8Array before encoding.
An encoder function that converts bytes to hexadecimalrepresentation would return `'hello'` when given`new Uint8Array([104, 101, 108, 108, 111])`. Copy
An encoder function that converts bytes to hexadecimalrepresentation would return `'hello'` when given`new Uint8Array([104, 101, 108, 108, 111])`.
Caution: the any type on the input is for backwards compatibility. Runtime support is limited to Uint8Array and string by default.
any
You may choose to support more encoder input types if overriding the default implementations.
A function that, given a Uint8Array of bytes, can produce a string representation thereof. The function may optionally attempt to convert other input types to Uint8Array before encoding.
Example