@technobuddha/library
Version:
A large library of useful functions
25 lines (24 loc) • 951 B
TypeScript
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 `Base64Url`.
* @param chars - The string to encode
* @param encoding - The encoding of the input string
* @returns An ASCII string containing the `Base64Url` representation
* @example
* ```typescript
* encodeBase64Url('Hello, world!', 'utf8'); // "SGVsbG8sIHdvcmxkIQ"
* ```
*/
export declare function encodeBase64Url(chars: string, encoding: TextEncoding): string;
/**
* Encode a {@link BinaryObject} to a `Base64Url` string.
* @param binary - The Binary object to encode
* @returns An ASCII string containing the `Base64Url` representation
* @example
* ```typescript
* encodeBase64Url(new Uint8Array([1, 2, 3])); // "AQID"
* ```
*/
export declare function encodeBase64Url(binary: BinaryObject): string;