UNPKG

@technobuddha/library

Version:
25 lines (24 loc) 928 B
import { type TextEncoding } from './@types/text-encoding.ts'; import { type BinaryObject } from './binary-object.ts'; /** * Convert a string to binary using {@link encodeText} with the supplied encoding, and then * encode it to `Base64`. * @param chars - The string to encode * @param encoding - The encoding of the input string * @returns An ASCII string containing the `Base64` representation * @example * ```typescript * encodeBase64('Hello, world!', 'utf8'); // "SGVsbG8sIHdvcmxkIQ==" * ``` */ export declare function encodeBase64(chars: string, encoding: TextEncoding): string; /** * Encode a {@link BinaryObject} to a `Base64` string. * @param binary - The Binary object to encode * @returns An ASCII string containing the `Base64` representation * @example * ```typescript * encodeBase64(new Uint8Array([1, 2, 3]); // "AQID" * ``` */ export declare function encodeBase64(binary: BinaryObject): string;