( input: string | Uint8Array_ | ArrayBuffer, )
| 58 | * ``` |
| 59 | */ |
| 60 | export function encodeHex( |
| 61 | input: string | Uint8Array_ | ArrayBuffer, |
| 62 | ): string { |
| 63 | if (typeof input === "string") { |
| 64 | input = new TextEncoder().encode(input) as Uint8Array_; |
| 65 | } else if (input instanceof ArrayBuffer) { |
| 66 | input = new Uint8Array(input); |
| 67 | } |
| 68 | const [output, i] = detach( |
| 69 | input as Uint8Array_, |
| 70 | calcSizeHex((input as Uint8Array_).length), |
| 71 | ); |
| 72 | encode(output, i, 0, alphabet); |
| 73 | return new TextDecoder().decode(output); |
| 74 | } |
| 75 | |
| 76 | /** |
| 77 | * `encodeIntoHex` takes an input source and encodes it as hex into the |
nothing calls this directly
no test coverage detected