@tothalex/cloud 0.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
File without changes
package/src/dns.d.ts ADDED
@@ -0,0 +1,99 @@
1
+ /**
2
+ * The `dns` module enables name resolution. For example, use it to look up IP
3
+ * addresses of host names.
4
+ *
5
+ * Although named for the [Domain Name System (DNS)](https://en.wikipedia.org/wiki/Domain_Name_System), it does not always use the
6
+ * DNS protocol for lookups. {@link lookup} uses the operating system
7
+ * facilities to perform name resolution. It may not need to perform any network
8
+ * communication. To perform name resolution the way other applications on the same
9
+ * system do, use {@link lookup}.
10
+ *
11
+ * ```js
12
+ * import dns from 'dns';
13
+ *
14
+ * dns.lookup('example.org', (err, address, family) => {
15
+ * console.log('address: %j family: IPv%s', address, family);
16
+ * });
17
+ * // address: "93.184.216.34" family: IPv4
18
+ * ```
19
+ *
20
+ */
21
+ declare module "dns" {
22
+ export interface LookupOptions {
23
+ /**
24
+ * The record family. Must be `4`, `6`, or `0`.
25
+ * The value 0 indicates that either an IPv4 or IPv6 address is returned.
26
+ * @default 0
27
+ */
28
+ family?: number | undefined;
29
+ }
30
+ export interface LookupAddress {
31
+ /**
32
+ * A string representation of an IPv4 or IPv6 address.
33
+ */
34
+ address: string;
35
+ /**
36
+ * `4` or `6`, denoting the family of `address`, or `0` if the address is not an IPv4 or IPv6 address. `0` is a likely indicator of a
37
+ * bug in the name resolution service used by the operating system.
38
+ */
39
+ family: number;
40
+ }
41
+ /**
42
+ * Resolves a host name (e.g. `'nodejs.org'`) into the first found A (IPv4) or
43
+ * AAAA (IPv6) record. All `option` properties are optional. If `options` is an
44
+ * integer, then it must be `4` or `6` – if `options` is `0` or not provided, then
45
+ * IPv4 and IPv6 addresses are both returned if found.
46
+ *
47
+ * On error, `err` is an `Error` object, where `err.code` is the error code.
48
+ * Keep in mind that `err.code` will be set to `'ENOTFOUND'` not only when
49
+ * the host name does not exist but also when the lookup fails in other ways
50
+ * such as no available file descriptors.
51
+ *
52
+ * `dns.lookup()` does not necessarily have anything to do with the DNS protocol.
53
+ * The implementation uses an operating system facility that can associate names
54
+ * with addresses and vice versa.
55
+ *
56
+ * Example usage:
57
+ *
58
+ * ```js
59
+ * import dns from 'dns';
60
+ * const options = {
61
+ * family: 6,
62
+ * };
63
+ * dns.lookup('example.com', options, (err, address, family) =>
64
+ * console.log('address: %j family: IPv%s', address, family));
65
+ * // address: "2606:2800:220:1:248:1893:25c8:1946" family: IPv6
66
+ *
67
+ * ```
68
+ *
69
+ */
70
+ export function lookup(
71
+ hostname: string,
72
+ family: number,
73
+ callback: (
74
+ err: DOMException | null,
75
+ address: string,
76
+ family: number
77
+ ) => void
78
+ ): void;
79
+ export function lookup(
80
+ hostname: string,
81
+ options: LookupOptions,
82
+ callback: (
83
+ err: DOMException | null,
84
+ address: string | LookupAddress[],
85
+ family: number
86
+ ) => void
87
+ ): void;
88
+ export function lookup(
89
+ hostname: string,
90
+ callback: (
91
+ err: DOMException | null,
92
+ address: string,
93
+ family: number
94
+ ) => void
95
+ ): void;
96
+ }
97
+ declare module "dns" {
98
+ export * from "dns";
99
+ }
@@ -0,0 +1,245 @@
1
+ declare module "events" {
2
+ type EventMap<T> = Record<keyof T, any[]> | DefaultEventMap;
3
+ type DefaultEventMap = [never];
4
+ type AnyRest = [...args: any[]];
5
+ type Args<K, T> = T extends DefaultEventMap
6
+ ? AnyRest
7
+ : K extends keyof T
8
+ ? T[K]
9
+ : never;
10
+ type Key<K, T> = T extends DefaultEventMap ? EventKey : K | keyof T;
11
+ type Key2<K, T> = T extends DefaultEventMap ? EventKey : K & keyof T;
12
+ type Listener<K, T, F> = T extends DefaultEventMap
13
+ ? F
14
+ : K extends keyof T
15
+ ? T[K] extends unknown[]
16
+ ? (...args: T[K]) => void
17
+ : never
18
+ : never;
19
+ type Listener1<K, T> = Listener<K, T, (...args: any[]) => void>;
20
+
21
+ export class EventEmitter<T extends EventMap<T> = DefaultEventMap> {
22
+ constructor();
23
+
24
+ /**
25
+ * Alias for `emitter.on(eventName, listener)`.
26
+ */
27
+ addListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
28
+
29
+ /**
30
+ * Adds the `listener` function to the end of the listeners array for the event
31
+ * named `eventName`. No checks are made to see if the `listener` has already
32
+ * been added. Multiple calls passing the same combination of `eventName` and
33
+ * `listener` will result in the `listener` being added, and called, multiple times.
34
+ *
35
+ * ```js
36
+ * server.on('connection', (stream) => {
37
+ * console.log('someone connected!');
38
+ * });
39
+ * ```
40
+ *
41
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
42
+ *
43
+ * By default, event listeners are invoked in the order they are added. The `emitter.prependListener()` method can be used as an alternative to add the
44
+ * event listener to the beginning of the listeners array.
45
+ *
46
+ * ```js
47
+ * import { EventEmitter } from 'events';
48
+ * const myEE = new EventEmitter();
49
+ * myEE.on('foo', () => console.log('a'));
50
+ * myEE.prependListener('foo', () => console.log('b'));
51
+ * myEE.emit('foo');
52
+ * // Prints:
53
+ * // b
54
+ * // a
55
+ * ```
56
+ * @param eventName The name of the event.
57
+ * @param listener The callback function
58
+ */
59
+ on<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
60
+
61
+ /**
62
+ * Adds a **one-time** `listener` function for the event named `eventName`. The
63
+ * next time `eventName` is triggered, this listener is removed and then invoked.
64
+ *
65
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
66
+ *
67
+ * By default, event listeners are invoked in the order they are added. The `emitter.prependOnceListener()` method can be used as an alternative to add the
68
+ * event listener to the beginning of the listeners array.
69
+ *
70
+ * ```js
71
+ * import { EventEmitter } from 'events';
72
+ * const myEE = new EventEmitter();
73
+ * myEE.once('foo', () => console.log('a'));
74
+ * myEE.prependOnceListener('foo', () => console.log('b'));
75
+ * myEE.emit('foo');
76
+ * // Prints:
77
+ * // b
78
+ * // a
79
+ * ```
80
+ * @since v0.3.0
81
+ * @param eventName The name of the event.
82
+ * @param listener The callback function
83
+ */
84
+ once<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
85
+
86
+ /**
87
+ * Removes the specified `listener` from the listener array for the event named `eventName`.
88
+ *
89
+ * `removeListener()` will remove, at most, one instance of a listener from the
90
+ * listener array. If any single listener has been added multiple times to the
91
+ * listener array for the specified `eventName`, then `removeListener()` must be
92
+ * called multiple times to remove each instance.
93
+ *
94
+ * Once an event is emitted, all listeners attached to it at the time of emitting are called in order.
95
+ * This implies that any `removeListener()` calls _after_ emitting and _before_ the last listener finishes execution
96
+ * will not remove them from `emit()` in progress. Subsequent events behave as expected.
97
+ *
98
+ * ```js
99
+ * import { EventEmitter } from 'events';
100
+ * class MyEmitter extends EventEmitter {}
101
+ * const myEmitter = new MyEmitter();
102
+ *
103
+ * const callbackA = () => {
104
+ * console.log('A');
105
+ * myEmitter.removeListener('event', callbackB);
106
+ * };
107
+ *
108
+ * const callbackB = () => {
109
+ * console.log('B');
110
+ * };
111
+ *
112
+ * myEmitter.on('event', callbackA);
113
+ *
114
+ * myEmitter.on('event', callbackB);
115
+ *
116
+ * // callbackA removes listener callbackB but it will still be called.
117
+ * // Internal listener array at time of emit [callbackA, callbackB]
118
+ * myEmitter.emit('event');
119
+ * // Prints:
120
+ * // A
121
+ * // B
122
+ *
123
+ * // callbackB is now removed.
124
+ * // Internal listener array [callbackA]
125
+ * myEmitter.emit('event');
126
+ * // Prints:
127
+ * // A
128
+ * ```
129
+ *
130
+ * Because listeners are managed using an internal array, calling this will
131
+ * change the position indices of any listener registered _after_ the listener
132
+ * being removed. This will not impact the order in which listeners are called,
133
+ * but it means that any copies of the listener array as returned by
134
+ * the `emitter.listeners()` method will need to be recreated.
135
+ *
136
+ * When a single function has been added as a handler multiple times for a single
137
+ * event (as in the example below), `removeListener()` will remove the most
138
+ * recently added instance. In the example the `once('ping')` listener is removed:
139
+ *
140
+ * ```js
141
+ * import { EventEmitter } from 'events';
142
+ * const ee = new EventEmitter();
143
+ *
144
+ * function pong() {
145
+ * console.log('pong');
146
+ * }
147
+ *
148
+ * ee.on('ping', pong);
149
+ * ee.once('ping', pong);
150
+ * ee.removeListener('ping', pong);
151
+ *
152
+ * ee.emit('ping');
153
+ * ee.emit('ping');
154
+ * ```
155
+ *
156
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
157
+ */
158
+ removeListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
159
+
160
+ /**
161
+ * Alias for `emitter.removeListener()`.
162
+ */
163
+ off<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
164
+
165
+ /**
166
+ * Synchronously calls each of the listeners registered for the event named `eventName`, in the order they were registered, passing the supplied arguments
167
+ * to each.
168
+ *
169
+ * ```js
170
+ * import { EventEmitter } from 'events';
171
+ * const myEmitter = new EventEmitter();
172
+ *
173
+ * // First listener
174
+ * myEmitter.on('event', function firstListener() {
175
+ * console.log('Helloooo! first listener');
176
+ * });
177
+ * // Second listener
178
+ * myEmitter.on('event', function secondListener(arg1, arg2) {
179
+ * console.log(`event with parameters ${arg1}, ${arg2} in second listener`);
180
+ * });
181
+ * // Third listener
182
+ * myEmitter.on('event', function thirdListener(...args) {
183
+ * const parameters = args.join(', ');
184
+ * console.log(`event with parameters ${parameters} in third listener`);
185
+ * });
186
+ *
187
+ * myEmitter.emit('event', 1, 2, 3, 4, 5);
188
+ *
189
+ * // Prints:
190
+ * // Helloooo! first listener
191
+ * // event with parameters 1, 2 in second listener
192
+ * // event with parameters 1, 2, 3, 4, 5 in third listener
193
+ * ```
194
+ */
195
+ emit<K>(eventName: Key<K, T>, ...args: Args<K, T>): void;
196
+
197
+ /**
198
+ * Adds the `listener` function to the _beginning_ of the listeners array for the
199
+ * event named `eventName`. No checks are made to see if the `listener` has
200
+ * already been added. Multiple calls passing the same combination of `eventName`
201
+ * and `listener` will result in the `listener` being added, and called, multiple times.
202
+ *
203
+ *
204
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
205
+ * @param eventName The name of the event.
206
+ * @param listener The callback function
207
+ */
208
+ prependListener<K>(eventName: Key<K, T>, listener: Listener1<K, T>): this;
209
+
210
+ /**
211
+ * Adds a **one-time**`listener` function for the event named `eventName` to the _beginning_ of the listeners array.
212
+ * The next time `eventName` is triggered, this listener is removed, and then invoked.
213
+ *
214
+ * Returns a reference to the `EventEmitter`, so that calls can be chained.
215
+ * @param eventName The name of the event.
216
+ * @param listener The callback function
217
+ */
218
+ prependOnceListener<K>(
219
+ eventName: Key<K, T>,
220
+ listener: Listener1<K, T>
221
+ ): this;
222
+
223
+ /**
224
+ * Returns an array listing the events for which the emitter has registered
225
+ * listeners. The values in the array are strings or `Symbol`s.
226
+ *
227
+ * ```js
228
+ * import { EventEmitter } from 'events';
229
+ *
230
+ * const myEE = new EventEmitter();
231
+ * myEE.on('foo', () => {});
232
+ * myEE.on('bar', () => {});
233
+ *
234
+ * const sym = Symbol('symbol');
235
+ * myEE.on(sym, () => {});
236
+ *
237
+ * console.log(myEE.eventNames());
238
+ * // Prints: [ 'foo', 'bar', Symbol(symbol) ]
239
+ * ```
240
+ */
241
+ eventNames(): Array<EventKey & Key2<unknown, T>>;
242
+ }
243
+
244
+ export default EventEmitter;
245
+ }
@@ -0,0 +1,26 @@
1
+ export {};
2
+
3
+ declare global {
4
+ interface Error {
5
+ name: string;
6
+ message: string;
7
+ stack?: string;
8
+ }
9
+
10
+ interface ErrorConstructor {
11
+ new (message?: string): Error;
12
+ (message?: string): Error;
13
+ readonly prototype: Error;
14
+ }
15
+
16
+ interface DOMException extends Error {
17
+ readonly message: string;
18
+ readonly name: string;
19
+ readonly stack: string;
20
+ }
21
+ var Error: ErrorConstructor;
22
+ var DOMException: {
23
+ prototype: DOMException;
24
+ new (message?: string, name?: string): DOMException;
25
+ };
26
+ }
package/src/http.d.ts ADDED
@@ -0,0 +1,325 @@
1
+ export {};
2
+
3
+ declare global {
4
+ interface BlobOpts {
5
+ /**
6
+ * One of either `'transparent'` or `'native'`. When set to `'native'`, line endings in string source parts
7
+ * will be converted to the platform native line-ending as specified by `import { EOL } from 'os'`.
8
+ */
9
+ endings?: "transparent" | "native";
10
+ /**
11
+ * The Blob content-type. The intent is for `type` to convey the MIME media type of the data,
12
+ * however no validation of the type format is performed.
13
+ */
14
+ type?: string | undefined;
15
+ }
16
+
17
+ /**
18
+ * The `Body` of a {@link Response} or {@link Request}.
19
+ * Currently NOT a `ReadableStream`.
20
+ */
21
+ type Body = QuickJS.ArrayBufferView | Blob | null;
22
+
23
+ /**
24
+ * A [`Blob`](https://developer.mozilla.org/en-US/docs/Web/API/Blob) encapsulates immutable, raw data.
25
+ */
26
+ class Blob {
27
+ /**
28
+ * Creates a new `Blob` object containing a concatenation of the given sources.
29
+ *
30
+ * {ArrayBuffer}, and {Blob} sources are copied into the 'Blob' and can therefore be
31
+ * safely modified after the 'Blob' is created.
32
+ *
33
+ * String sources are also copied into the `Blob`.
34
+ */
35
+ constructor(parts: Array<ArrayBuffer | string | Blob>, opts?: BlobOpts);
36
+ /**
37
+ * The total size of the `Blob` in bytes.
38
+ */
39
+ readonly size: number;
40
+ /**
41
+ * The content-type of the `Blob`.
42
+ */
43
+ readonly type: string;
44
+ /**
45
+ * Returns a promise that fulfills with an [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) containing a copy of
46
+ * the `Blob` data.
47
+ */
48
+ arrayBuffer(): Promise<ArrayBuffer>;
49
+ /**
50
+ * Creates and returns a new `Blob` containing a subset of this `Blob` objects
51
+ * data. The original `Blob` is not altered.
52
+ * @param start The starting index.
53
+ * @param end The ending index.
54
+ * @param type The content-type for the new `Blob`
55
+ */
56
+ slice(start?: number, end?: number, type?: string): Blob;
57
+ /**
58
+ * Returns a promise that fulfills with the contents of the `Blob` decoded as a UTF-8 string.
59
+ */
60
+ text(): Promise<string>;
61
+ /**
62
+ * Returns a promise that resolves with an Uint8Array containing the contents of the Blob.
63
+ */
64
+ bytes(): Promise<Uint8Array>;
65
+ }
66
+
67
+ interface FileOpts extends BlobOpts {
68
+ /**
69
+ * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
70
+ * Files without a known last modified date return the current date.
71
+ */
72
+ lastModified?: number;
73
+ }
74
+
75
+ class File extends Blob {
76
+ /**
77
+ * Returns a newly constructed File.
78
+ */
79
+ constructor(
80
+ data: Array<ArrayBuffer | string | Blob>,
81
+ fileName: string,
82
+ opts?: FileOpts
83
+ );
84
+ /**
85
+ * Name of the file referenced by the File object.
86
+ */
87
+ readonly name: string;
88
+ /**
89
+ * The last modified date of the file as the number of milliseconds since the Unix epoch (January 1, 1970 at midnight).
90
+ * Files without a known last modified date return the current date.
91
+ */
92
+ readonly lastModified: number;
93
+ }
94
+
95
+ type HeadersLike = Record<string, string> | Headers;
96
+
97
+ type HeadersOpts = string[][] | HeadersLike;
98
+
99
+ class Headers implements Iterable<[string, string]> {
100
+ /**
101
+ * Creates a new Headers object.
102
+ */
103
+ constructor(opts?: HeadersOpts);
104
+ /**
105
+ * Appends a new value onto an existing header inside a Headers object, or adds the header if it does not already exist.
106
+ */
107
+ readonly append: (name: string, value: string) => void;
108
+ /**
109
+ * Deletes a header from a Headers object.
110
+ */
111
+ readonly delete: (name: string) => void;
112
+ /**
113
+ * A String sequence representing the values of the retrieved header or null if this header is not set.
114
+ */
115
+ readonly get: (name: string) => string | null;
116
+ /**
117
+ * Returns a boolean stating whether a Headers object contains a certain header.
118
+ */
119
+ readonly has: (name: string) => boolean;
120
+ /**
121
+ * Sets a new value for an existing header inside a Headers object, or adds the header if it does not already exist.
122
+ */
123
+ readonly set: (name: string, value: string) => void;
124
+ /**
125
+ * Returns an array containing the values of all Set-Cookie headers associated with a response.
126
+ */
127
+ readonly getSetCookie: () => string[];
128
+ /**
129
+ * Executes a provided function once for each key/value pair in this Headers object.
130
+ */
131
+ readonly forEach: (
132
+ callbackfn: (value: string, key: string) => void
133
+ ) => void;
134
+ /**
135
+ * Returns an iterator allowing you to go through all keys of the key/value pairs contained in this object.
136
+ */
137
+ readonly keys: () => IterableIterator<string>;
138
+ /**
139
+ * Returns an iterator allowing you to go through all values of the key/value pairs contained in this object.
140
+ */
141
+ readonly values: () => IterableIterator<string>;
142
+ /**
143
+ * Returns an iterator allowing to go through all key/value pairs contained in this object.
144
+ */
145
+ readonly entries: () => IterableIterator<[string, string]>;
146
+ readonly [Symbol.iterator]: () => Iterator<[string, string]>;
147
+ }
148
+
149
+ interface RequestOpts {
150
+ url?: string;
151
+ method?: string;
152
+ signal?: AbortSignal;
153
+ body?: Blob;
154
+ headers?: HeadersLike;
155
+ }
156
+
157
+ type RequestCache = "no-cache";
158
+
159
+ type RequestMode = "navigate";
160
+
161
+ /**
162
+ * The Request interface of the Fetch API represents a resource request.
163
+ */
164
+ class Request {
165
+ /**
166
+ * Creates a new Request object.
167
+ */
168
+ constructor(input: string | URL | Request, init?: RequestOpts);
169
+ /**
170
+ * Contains the cache mode of the request
171
+ */
172
+ readonly cache: RequestCache;
173
+ /**
174
+ * Contains the associated Headers object of the request.
175
+ */
176
+ readonly headers: Headers;
177
+ /**
178
+ * Contains the request's method (GET, POST, etc.)
179
+ */
180
+ readonly method: string;
181
+ /**
182
+ * Contains the mode of the request
183
+ */
184
+ readonly mode: RequestMode;
185
+ /**
186
+ * Contains the URL of the request.
187
+ */
188
+ readonly url: string;
189
+ /**
190
+ * Contains the request's keepalive setting (true or false), which indicates whether llrt will
191
+ * keep the associated connection alive.
192
+ */
193
+ readonly keepalive: boolean;
194
+ /**
195
+ * Returns the {@link AbortSignal} associated with the request
196
+ */
197
+ readonly signal: AbortSignal;
198
+ /**
199
+ * The body content.
200
+ */
201
+ readonly body: Body;
202
+ /**
203
+ * Stores true or false to indicate whether or not the body has been used in a request yet.
204
+ */
205
+ readonly bodyUsed: boolean;
206
+ /**
207
+ * Returns a promise that resolves with an ArrayBuffer representation of the request body.
208
+ */
209
+ readonly arrayBuffer: () => Promise<ArrayBuffer>;
210
+ /**
211
+ * Returns a promise that resolves with a {@link Blob} representation of the request body.
212
+ */
213
+ readonly blob: () => Promise<Blob>;
214
+ /**
215
+ * Returns a promise that resolves with a {@link Uint8Array} representation of the request body.
216
+ */
217
+ readonly bytes: () => Promise<Uint8Array>;
218
+ /**
219
+ * Returns a promise that resolves with the result of parsing the request body as JSON.
220
+ */
221
+ readonly json: () => Promise<unknown>;
222
+ /**
223
+ * Returns a promise that resolves with a text representation of the request body.
224
+ */
225
+ readonly text: () => Promise<string>;
226
+ /**
227
+ * Creates a copy of the current {@link Request} object.
228
+ */
229
+ readonly clone: () => Request;
230
+ }
231
+
232
+ type ResponseType = "basic" | "error";
233
+
234
+ interface ResponseInit {
235
+ readonly status?: number;
236
+ readonly statusText?: string;
237
+ readonly headers?: HeadersLike;
238
+ }
239
+
240
+ interface ResponseOpts extends ResponseInit {
241
+ readonly url?: string;
242
+ readonly signal?: AbortSignal;
243
+ }
244
+
245
+ /**
246
+ * The Response interface of the Fetch API represents the response to a request.
247
+ */
248
+ class Response {
249
+ /**
250
+ * Creates a new Response object.
251
+ */
252
+ constructor(body?: Body, opts?: ResponseOpts);
253
+
254
+ /**
255
+ * The {@link Headers} object associated with the response.
256
+ */
257
+ readonly headers: Headers;
258
+ /**
259
+ * A boolean indicating whether the response was successful (status in the range 200 – 299) or not.
260
+ */
261
+ readonly ok: boolean;
262
+ /**
263
+ * The status code of the response. (This will be 200 for a success).
264
+ */
265
+ readonly status: number;
266
+ /**
267
+ * The status message corresponding to the status code. (e.g., OK for 200).
268
+ */
269
+ readonly statusText: string;
270
+ /**
271
+ * The type of the response.
272
+ */
273
+ readonly type: ResponseType;
274
+ readonly url: string;
275
+ /**
276
+ * Indicates whether or not the response is the result of a redirect (that is, its URL list has more than one entry).
277
+ */
278
+ readonly redirected: boolean;
279
+ /**
280
+ * The body content (NOT IMPLEMENTED YET).
281
+ */
282
+ readonly body: null;
283
+ /**
284
+ * Stores a boolean value that declares whether the body has been used in a response yet.
285
+ */
286
+ readonly bodyUsed: boolean;
287
+ /**
288
+ * Returns a promise that resolves with an {@link ArrayBuffer} representation of the response body.
289
+ */
290
+ readonly arrayBuffer: () => Promise<ArrayBuffer>;
291
+ /**
292
+ * Returns a promise that resolves with a {@link Blob} representation of the response body.
293
+ */
294
+ readonly blob: () => Promise<Blob>;
295
+ /**
296
+ * Returns a promise that resolves with the result of parsing the response body text as JSON.
297
+ */
298
+ readonly json: () => Promise<unknown>;
299
+ /**
300
+ * Returns a promise that resolves with a text representation of the response body.
301
+ */
302
+ readonly text: () => Promise<string>;
303
+ /**
304
+ * Creates a clone of a {@link Response} object.
305
+ */
306
+ readonly clone: () => Response;
307
+ /**
308
+ * Returns a new {@link Response} object associated with a network error.
309
+ */
310
+ static error(): Response;
311
+ /**
312
+ * Returns a new {@link Response} object for returning the provided JSON encoded data.
313
+ */
314
+ static json(data: any, init?: ResponseInit): Response;
315
+ /**
316
+ * Returns a new {@link Response} with a different URL.
317
+ */
318
+ static redirect(url: string | URL, status?: number): Response;
319
+ }
320
+
321
+ function fetch(
322
+ input: string | URL | Request,
323
+ init?: RequestOpts
324
+ ): Promise<Response>;
325
+ }