|
1 | | -export = base64; |
2 | | - |
3 | 1 | /** |
4 | | - * A minimal base64 implementation for number arrays. |
5 | | - * @memberof util |
6 | | - * @namespace |
| 2 | + * Calculates the byte length of a base64 encoded string. |
| 3 | + * @param {string} string Base64 encoded string |
| 4 | + * @returns {number} Byte length |
7 | 5 | */ |
8 | | -declare namespace base64 { |
9 | | - |
10 | | - /** |
11 | | - * Calculates the byte length of a base64 encoded string. |
12 | | - * @param {string} string Base64 encoded string |
13 | | - * @returns {number} Byte length |
14 | | - */ |
15 | | - function length(string: string): number; |
| 6 | +export function length(string: string): number; |
16 | 7 |
|
17 | | - /** |
18 | | - * Encodes a buffer to a base64 encoded string. |
19 | | - * @param {Uint8Array} buffer Source buffer |
20 | | - * @param {number} start Source start |
21 | | - * @param {number} end Source end |
22 | | - * @returns {string} Base64 encoded string |
23 | | - */ |
24 | | - function encode(buffer: Uint8Array, start: number, end: number): string; |
| 8 | +/** |
| 9 | + * Encodes a buffer to a base64 encoded string. |
| 10 | + * @param {Uint8Array} buffer Source buffer |
| 11 | + * @param {number} start Source start |
| 12 | + * @param {number} end Source end |
| 13 | + * @returns {string} Base64 encoded string |
| 14 | + */ |
| 15 | +export function encode(buffer: Uint8Array, start: number, end: number): string; |
25 | 16 |
|
26 | | - /** |
27 | | - * Decodes a base64 encoded string to a buffer. |
28 | | - * @param {string} string Source string |
29 | | - * @param {Uint8Array} buffer Destination buffer |
30 | | - * @param {number} offset Destination offset |
31 | | - * @returns {number} Number of bytes written |
32 | | - * @throws {Error} If encoding is invalid |
33 | | - */ |
34 | | - function decode(string: string, buffer: Uint8Array, offset: number): number; |
| 17 | +/** |
| 18 | + * Decodes a base64 encoded string to a buffer. |
| 19 | + * @param {string} string Source string |
| 20 | + * @param {Uint8Array} buffer Destination buffer |
| 21 | + * @param {number} offset Destination offset |
| 22 | + * @returns {number} Number of bytes written |
| 23 | + * @throws {Error} If encoding is invalid |
| 24 | + */ |
| 25 | +export function decode(string: string, buffer: Uint8Array, offset: number): number; |
35 | 26 |
|
36 | | - /** |
37 | | - * Tests if the specified string appears to be base64 encoded. |
38 | | - * @param {string} string String to test |
39 | | - * @returns {boolean} `true` if it appears to be base64 encoded, otherwise false |
40 | | - */ |
41 | | - function test(string: string): boolean; |
42 | | -} |
| 27 | +/** |
| 28 | + * Tests if the specified string appears to be base64 encoded. |
| 29 | + * @param {string} string String to test |
| 30 | + * @returns {boolean} `true` if it appears to be base64 encoded, otherwise false |
| 31 | + */ |
| 32 | +export function test(string: string): boolean; |
0 commit comments