vendored binaries of common web development dependencies
3.4 kB
90 lines
1/*! *****************************************************************************
2Copyright (c) Microsoft Corporation. All rights reserved.
3Licensed under the Apache License, Version 2.0 (the "License"); you may not use
4this file except in compliance with the License. You may obtain a copy of the
5License at http://www.apache.org/licenses/LICENSE-2.0
6
7THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
8KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
9WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
10MERCHANTABILITY OR NON-INFRINGEMENT.
11
12See the Apache Version 2.0 License for specific language governing permissions
13and limitations under the License.
14***************************************************************************** */
15
16
17interface Uint8Array<TArrayBuffer extends ArrayBufferLike> {
18 /**
19 * Converts the `Uint8Array` to a base64-encoded string.
20 * @param options If provided, sets the alphabet and padding behavior used.
21 * @returns A base64-encoded string.
22 */
23 toBase64(
24 options?: {
25 alphabet?: "base64" | "base64url" | undefined;
26 omitPadding?: boolean | undefined;
27 },
28 ): string;
29
30 /**
31 * Sets the `Uint8Array` from a base64-encoded string.
32 * @param string The base64-encoded string.
33 * @param options If provided, specifies the alphabet and handling of the last chunk.
34 * @returns An object containing the number of bytes read and written.
35 * @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last
36 * chunk is inconsistent with the `lastChunkHandling` option.
37 */
38 setFromBase64(
39 string: string,
40 options?: {
41 alphabet?: "base64" | "base64url" | undefined;
42 lastChunkHandling?: "loose" | "strict" | "stop-before-partial" | undefined;
43 },
44 ): {
45 read: number;
46 written: number;
47 };
48
49 /**
50 * Converts the `Uint8Array` to a base16-encoded string.
51 * @returns A base16-encoded string.
52 */
53 toHex(): string;
54
55 /**
56 * Sets the `Uint8Array` from a base16-encoded string.
57 * @param string The base16-encoded string.
58 * @returns An object containing the number of bytes read and written.
59 */
60 setFromHex(string: string): {
61 read: number;
62 written: number;
63 };
64}
65
66interface Uint8ArrayConstructor {
67 /**
68 * Creates a new `Uint8Array` from a base64-encoded string.
69 * @param string The base64-encoded string.
70 * @param options If provided, specifies the alphabet and handling of the last chunk.
71 * @returns A new `Uint8Array` instance.
72 * @throws {SyntaxError} If the input string contains characters outside the specified alphabet, or if the last
73 * chunk is inconsistent with the `lastChunkHandling` option.
74 */
75 fromBase64(
76 string: string,
77 options?: {
78 alphabet?: "base64" | "base64url" | undefined;
79 lastChunkHandling?: "loose" | "strict" | "stop-before-partial" | undefined;
80 },
81 ): Uint8Array<ArrayBuffer>;
82
83 /**
84 * Creates a new `Uint8Array` from a base16-encoded string.
85 * @returns A new `Uint8Array` instance.
86 */
87 fromHex(
88 string: string,
89 ): Uint8Array<ArrayBuffer>;
90}