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

An encoder function that converts bytes to hexadecimal
representation would return `'hello'` when given
`new Uint8Array([104, 101, 108, 108, 111])`.
interface Encoder ((input) => string)
  • Caution: the any type on the input is for backwards compatibility. Runtime support is limited to Uint8Array and string by default.

    You may choose to support more encoder input types if overriding the default implementations.

    Parameters

    • input: any

    Returns string