UNPKG

byte-encodings

Version:

Utilities for encoding and decoding common formats like hex, base64, and varint. Ported from Deno's @std/encoding.

30 lines (28 loc) 817 B
/** * Options for encoding and decoding base32 strings. */ interface Base32Options { /** The base32 alphabet. Defaults to "base32" */ alphabet?: Base32Alphabet; } /** * The base32 alphabets. */ type Base32Alphabet = "base32" | "base32hex" | "base32crockford"; /** * Calculate the output size needed to encode a given input size for * {@linkcode encodeIntoBase32}. * * @param rawSize The size of the input buffer. * @returns The size of the output buffer. * * @example Basic Usage * ```ts * import { assertEquals } from "@std/assert"; * import { calcSizeBase32 } from "@std/encoding/unstable-base32"; * * assertEquals(calcSizeBase32(1), 8); * ``` */ declare function calcSizeBase32(rawSize: number): number; export { type Base32Options as B, type Base32Alphabet as a, calcSizeBase32 as c };