node-lib

@wtasnorg/node-lib


@wtasnorg/node-lib / encode32

Function: encode32()

encode32(input, charset?): string

Defined in: src/base32.ts:81

Encode a string to Base32.

Parameters

input

string

The string to encode.

charset?

"rfc4648" | "hex" | "crockford"

The charset variant to use (default: “rfc4648”).

Returns

string

The Base32 encoded string.

Example

import { encode32 } from "./base32.js";

encode32("Hello");
// => "JBSWY3DP"

encode32("test", "hex");
// => "EHMP6SS="