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) 807 B
/** * Options for encoding and decoding base64 strings. */ interface Base64Options { /** The base64 alphabet. Defaults to "base64" */ alphabet?: Base64Alphabet; } /** * The base64 alphabets. */ type Base64Alphabet = "base64" | "base64url"; /** * Calculate the output size needed to encode a given input size for * {@linkcode encodeIntoBase64}. * * @param originalSize The size of the input buffer. * @returns The size of the output buffer. * * @example Basic Usage * ```ts * import { assertEquals } from "@std/assert"; * import { calcSizeBase64 } from "@std/encoding/unstable-base64"; * * assertEquals(calcSizeBase64(1), 4); * ``` */ declare function calcSizeBase64(originalSize: number): number; export { type Base64Options as B, type Base64Alphabet as a, calcSizeBase64 as c };