UNPKG

1.34 kBTypeScriptView Raw
1// Type definitions for base-64 1.0
2// Project: https://github.com/mathiasbynens/base64, http://mths.be/base64
3// Definitions by: Dolan Miu <https://github.com/dolanmiu>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
6export as namespace base64;
7
8export const version: string;
9
10/**
11 * This function takes a byte string (the input parameter) and encodes it according to base64.
12 * The input data must be in the form of a string containing only characters
13 * in the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
14 * The base64.encode() function is designed to be fully compatible
15 * with btoa() as described in the HTML Standard.
16 * see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-btoa
17 */
18export function encode(input: string): string;
19/**
20 * This function takes a base64-encoded string (the input parameter) and decodes it.
21 * The return value is in the form of a string containing only characters in
22 * the range from U+0000 to U+00FF, each representing a binary byte with values 0x00 to 0xFF.
23 * The base64.decode() function is designed to be fully compatible
24 * with atob() as described in the HTML Standard.
25 * see: https://html.spec.whatwg.org/multipage/webappapis.html#dom-windowbase64-atob
26 */
27export function decode(input: string): string;