Built and signed on GitHub ActionsBuilt and signed on GitHub Actions
Utilities for encoding and decoding common formats like hex, base64, and varint
Functions to encode and decode to and from base32 strings.
import { assertEquals } from "@std/assert"; import { encodeBase32, type Uint8Array_ } from "@std/encoding/unstable-base32"; assertEquals( encodeBase32("Hello World", { alphabet: "base32" }), "JBSWY3DPEBLW64TMMQ======", ); assertEquals( encodeBase32( new TextEncoder().encode("Hello World") as Uint8Array_, { alphabet: "base32" }, ), "JBSWY3DPEBLW64TMMQ======", );
Functions
Calculate the output size needed to encode a given input size for
encodeIntoBase32.
decodeBase32 takes an input source and decodes it into a
Uint8Array<ArrayBuffer> using the specified format. If a
Uint8Array<ArrayBuffer> is provided as input then a subarray of
the input containing the decoded data is returned.
encodeBase32 takes an input source and encodes it into a base32 string. If
a Uint8Array<ArrayBuffer> or ArrayBuffer is provided,
the underlying source will be detached and reused for the encoding. If you
need the input source after providing it to this function, call .slice() to
pass in a copy.
encodeIntoBase32 takes an input source and encodes it as base32 into the
output buffer.
Interfaces
Options for encoding and decoding base32 strings.
- alphabet: Base32Alphabet
The base32 alphabet. Defaults to "base32"
Type Aliases
The base32 alphabets.