(
input: string | Uint8Array_ | ArrayBuffer,
options: Base32Options = {},
)
| 104 | * ``` |
| 105 | */ |
| 106 | export function encodeBase32( |
| 107 | input: string | Uint8Array_ | ArrayBuffer, |
| 108 | options: Base32Options = {}, |
| 109 | ): string { |
| 110 | options.alphabet ??= "base32"; |
| 111 | if (typeof input === "string") { |
| 112 | input = new TextEncoder().encode(input) as Uint8Array_; |
| 113 | } else if (input instanceof ArrayBuffer) { |
| 114 | input = new Uint8Array(input); |
| 115 | } |
| 116 | const [output, i] = detach( |
| 117 | input as Uint8Array_, |
| 118 | calcSizeBase32((input as Uint8Array_).length), |
| 119 | ); |
| 120 | encode(output, i, 0, alphabet[options.alphabet], padding); |
| 121 | return new TextDecoder().decode(output); |
| 122 | } |
| 123 | |
| 124 | /** |
| 125 | * `encodeIntoBase32` takes an input source and encodes it as base32 into the |
nothing calls this directly
no test coverage detected