1 | <div align="center">
|
2 | <br>
|
3 | <br>
|
4 | <img width="360" src="media/logo.svg" alt="Got">
|
5 | <br>
|
6 | <br>
|
7 | <br>
|
8 | <p align="center">Huge thanks to <a href="https://moxy.studio"><img src="https://sindresorhus.com/assets/thanks/moxy-logo.svg" width="150"></a> for sponsoring me!
|
9 | </p>
|
10 | <br>
|
11 | <br>
|
12 | </div>
|
13 |
|
14 | > Simplified HTTP requests
|
15 |
|
16 | [![Build Status: Linux](https://travis-ci.org/sindresorhus/got.svg?branch=master)](https://travis-ci.org/sindresorhus/got) [![Coverage Status](https://coveralls.io/repos/github/sindresorhus/got/badge.svg?branch=master)](https://coveralls.io/github/sindresorhus/got?branch=master) [![Downloads](https://img.shields.io/npm/dm/got.svg)](https://npmjs.com/got) [![Install size](https://packagephobia.now.sh/badge?p=got)](https://packagephobia.now.sh/result?p=got)
|
17 |
|
18 | Got is a human-friendly and powerful HTTP request library.
|
19 |
|
20 | It was created because the popular [`request`](https://github.com/request/request) package is bloated: [![Install size](https://packagephobia.now.sh/badge?p=request)](https://packagephobia.now.sh/result?p=request)
|
21 |
|
22 | Got is for Node.js. For browsers, we recommend [Ky](https://github.com/sindresorhus/ky).
|
23 |
|
24 |
|
25 | ## Highlights
|
26 |
|
27 | - [Promise & stream API](#api)
|
28 | - [Request cancelation](#aborting-the-request)
|
29 | - [RFC compliant caching](#cache-adapters)
|
30 | - [Follows redirects](#followredirect)
|
31 | - [Retries on failure](#retry)
|
32 | - [Progress events](#onuploadprogress-progress)
|
33 | - [Handles gzip/deflate](#decompress)
|
34 | - [Timeout handling](#timeout)
|
35 | - [Errors with metadata](#errors)
|
36 | - [JSON mode](#json)
|
37 | - [WHATWG URL support](#url)
|
38 | - [Hooks](https://github.com/sindresorhus/got#hooks)
|
39 | - [Instances with custom defaults](#instances)
|
40 | - [Composable](advanced-creation.md#merging-instances)
|
41 | - [Electron support](#useelectronnet)
|
42 | - [Used by ~2000 packages and ~500K repos](https://github.com/sindresorhus/got/network/dependents)
|
43 | - Actively maintained
|
44 |
|
45 | [See how Got compares to other HTTP libraries](#comparison)
|
46 |
|
47 |
|
48 | ## Install
|
49 |
|
50 | ```
|
51 | $ npm install got
|
52 | ```
|
53 |
|
54 | <a href="https://www.patreon.com/sindresorhus">
|
55 | <img src="https://c5.patreon.com/external/logo/become_a_patron_button@2x.png" width="160">
|
56 | </a>
|
57 |
|
58 |
|
59 | ## Usage
|
60 |
|
61 | ```js
|
62 | const got = require('got');
|
63 |
|
64 | (async () => {
|
65 | try {
|
66 | const response = await got('sindresorhus.com');
|
67 | console.log(response.body);
|
68 | //=> '<!doctype html> ...'
|
69 | } catch (error) {
|
70 | console.log(error.response.body);
|
71 | //=> 'Internal server error ...'
|
72 | }
|
73 | })();
|
74 | ```
|
75 |
|
76 | ###### Streams
|
77 |
|
78 | ```js
|
79 | const fs = require('fs');
|
80 | const got = require('got');
|
81 |
|
82 | got.stream('sindresorhus.com').pipe(fs.createWriteStream('index.html'));
|
83 |
|
84 | // For POST, PUT, and PATCH methods `got.stream` returns a `stream.Writable`
|
85 | fs.createReadStream('index.html').pipe(got.stream.post('sindresorhus.com'));
|
86 | ```
|
87 |
|
88 |
|
89 | ### API
|
90 |
|
91 | It's a `GET` request by default, but can be changed by using different methods or in the `options`.
|
92 |
|
93 | #### got(url, [options])
|
94 |
|
95 | Returns a Promise for a [`response` object](#response) or a [stream](#streams-1) if `options.stream` is set to true.
|
96 |
|
97 | ##### url
|
98 |
|
99 | Type: `string` `Object`
|
100 |
|
101 | The URL to request, as a string, a [`https.request` options object](https://nodejs.org/api/https.html#https_https_request_options_callback), or a [WHATWG `URL`](https://nodejs.org/api/url.html#url_class_url).
|
102 |
|
103 | Properties from `options` will override properties in the parsed `url`.
|
104 |
|
105 | If no protocol is specified, it will default to `https`.
|
106 |
|
107 | ##### options
|
108 |
|
109 | Type: `Object`
|
110 |
|
111 | Any of the [`https.request`](https://nodejs.org/api/https.html#https_https_request_options_callback) options.
|
112 |
|
113 | ###### baseUrl
|
114 |
|
115 | Type: `string` `Object`
|
116 |
|
117 | When specified, `url` will be prepended by `baseUrl`.<br>
|
118 | If you specify an absolute URL, it will skip the `baseUrl`.
|
119 |
|
120 | Very useful when used with `got.extend()` to create niche-specific Got instances.
|
121 |
|
122 | Can be a string or a [WHATWG `URL`](https://nodejs.org/api/url.html#url_class_url).
|
123 |
|
124 | Slash at the end of `baseUrl` and at the beginning of the `url` argument is optional:
|
125 |
|
126 | ```js
|
127 | await got('hello', {baseUrl: 'https://example.com/v1'});
|
128 | //=> 'https://example.com/v1/hello'
|
129 |
|
130 | await got('/hello', {baseUrl: 'https://example.com/v1/'});
|
131 | //=> 'https://example.com/v1/hello'
|
132 |
|
133 | await got('/hello', {baseUrl: 'https://example.com/v1'});
|
134 | //=> 'https://example.com/v1/hello'
|
135 | ```
|
136 |
|
137 | ###### headers
|
138 |
|
139 | Type: `Object`<br>
|
140 | Default: `{}`
|
141 |
|
142 | Request headers.
|
143 |
|
144 | Existing headers will be overwritten. Headers set to `null` will be omitted.
|
145 |
|
146 | ###### stream
|
147 |
|
148 | Type: `boolean`<br>
|
149 | Default: `false`
|
150 |
|
151 | Returns a `Stream` instead of a `Promise`. This is equivalent to calling `got.stream(url, [options])`.
|
152 |
|
153 | ###### body
|
154 |
|
155 | Type: `string` `Buffer` `stream.Readable` [`form-data` instance](https://github.com/form-data/form-data)
|
156 |
|
157 | *If you provide this option, `got.stream()` will be read-only.*
|
158 |
|
159 | The body that will be sent with a `POST` request.
|
160 |
|
161 | If present in `options` and `options.method` is not set, `options.method` will be set to `POST`.
|
162 |
|
163 | The `content-length` header will be automatically set if `body` is a `string` / `Buffer` / `fs.createReadStream` instance / [`form-data` instance](https://github.com/form-data/form-data), and `content-length` and `transfer-encoding` are not manually set in `options.headers`.
|
164 |
|
165 | ###### cookieJar
|
166 |
|
167 | Type: [`tough.CookieJar` instance](https://github.com/salesforce/tough-cookie#cookiejar)
|
168 |
|
169 | Cookie support. You don't have to care about parsing or how to store them. [Example.](#cookies)
|
170 |
|
171 | **Note:** `options.headers.cookie` will be overridden.
|
172 |
|
173 | ###### encoding
|
174 |
|
175 | Type: `string` `null`<br>
|
176 | Default: `'utf8'`
|
177 |
|
178 | [Encoding](https://nodejs.org/api/buffer.html#buffer_buffers_and_character_encodings) to be used on `setEncoding` of the response data. If `null`, the body is returned as a [`Buffer`](https://nodejs.org/api/buffer.html) (binary data).
|
179 |
|
180 | ###### form
|
181 |
|
182 | Type: `boolean`<br>
|
183 | Default: `false`
|
184 |
|
185 | *If you provide this option, `got.stream()` will be read-only.*
|
186 |
|
187 | If set to `true` and `Content-Type` header is not set, it will be set to `application/x-www-form-urlencoded`.
|
188 |
|
189 | `body` must be a plain object. It will be converted to a query string using [`(new URLSearchParams(object)).toString()`](https://nodejs.org/api/url.html#url_constructor_new_urlsearchparams_obj).
|
190 |
|
191 | ###### json
|
192 |
|
193 | Type: `boolean`<br>
|
194 | Default: `false`
|
195 |
|
196 | *If you use `got.stream()`, this option will be ignored.*
|
197 |
|
198 | If set to `true` and `Content-Type` header is not set, it will be set to `application/json`.
|
199 |
|
200 | Parse response body with `JSON.parse` and set `accept` header to `application/json`. If used in conjunction with the `form` option, the `body` will the stringified as querystring and the response parsed as JSON.
|
201 |
|
202 | `body` must be a plain object or array and will be stringified.
|
203 |
|
204 | ###### query
|
205 |
|
206 | Type: `string` `Object<string, string|number>` [`URLSearchParams`](https://developer.mozilla.org/en-US/docs/Web/API/URLSearchParams)
|
207 |
|
208 | Query string that will be added to the request URL. This will override the query string in `url`.
|
209 |
|
210 | If you need to pass in an array, you can do it using a `URLSearchParams` instance:
|
211 |
|
212 | ```js
|
213 | const got = require('got');
|
214 |
|
215 | const query = new URLSearchParams([['key', 'a'], ['key', 'b']]);
|
216 |
|
217 | got('https://example.com', {query});
|
218 |
|
219 | console.log(query.toString());
|
220 | //=> 'key=a&key=b'
|
221 | ```
|
222 |
|
223 | And if you need a different array format, you could use the [`query-string`](https://github.com/sindresorhus/query-string) package:
|
224 |
|
225 | ```js
|
226 | const got = require('got');
|
227 | const queryString = require('query-string');
|
228 |
|
229 | const query = queryString.stringify({key: ['a', 'b']}, {arrayFormat: 'bracket'});
|
230 |
|
231 | got('https://example.com', {query});
|
232 |
|
233 | console.log(query);
|
234 | //=> 'key[]=a&key[]=b'
|
235 | ```
|
236 |
|
237 | ###### timeout
|
238 |
|
239 | Type: `number` `Object`
|
240 |
|
241 | Milliseconds to wait for the server to end the response before aborting the request with [`got.TimeoutError`](#gottimeouterror) error (a.k.a. `request` property). By default, there's no timeout.
|
242 |
|
243 | This also accepts an `object` with the following fields to constrain the duration of each phase of the request lifecycle:
|
244 |
|
245 | - `lookup` starts when a socket is assigned and ends when the hostname has been resolved. Does not apply when using a Unix domain socket.
|
246 | - `connect` starts when `lookup` completes (or when the socket is assigned if lookup does not apply to the request) and ends when the socket is connected.
|
247 | - `secureConnect` starts when `connect` completes and ends when the handshaking process completes (HTTPS only).
|
248 | - `socket` starts when the socket is connected. See [request.setTimeout](https://nodejs.org/api/http.html#http_request_settimeout_timeout_callback).
|
249 | - `response` starts when the request has been written to the socket and ends when the response headers are received.
|
250 | - `send` starts when the socket is connected and ends with the request has been written to the socket.
|
251 | - `request` starts when the request is initiated and ends when the response's end event fires.
|
252 |
|
253 | ###### retry
|
254 |
|
255 | Type: `number` `Object`<br>
|
256 | Default:
|
257 | - retries: `2`
|
258 | - methods: `GET` `PUT` `HEAD` `DELETE` `OPTIONS` `TRACE`
|
259 | - statusCodes: [`408`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/408) [`413`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/413) [`429`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/429) [`500`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/500) [`502`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/502) [`503`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/503) [`504`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/504)
|
260 | - maxRetryAfter: `undefined`
|
261 |
|
262 | An object representing `retries`, `methods`, `statusCodes` and `maxRetryAfter` fields for the time until retry, allowed methods, allowed status codes and maximum [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) time.
|
263 |
|
264 | If `maxRetryAfter` is set to `undefined`, it will use `options.timeout`.<br>
|
265 | If [`Retry-After`](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Retry-After) header is greater than `maxRetryAfter`, it will cancel the request.
|
266 |
|
267 | Delays between retries counts with function `1000 * Math.pow(2, retry) + Math.random() * 100`, where `retry` is attempt number (starts from 0).
|
268 |
|
269 | The `retries` property can be a `number` or a `function` with `retry` and `error` arguments. The function must return a delay in milliseconds (`0` return value cancels retry).
|
270 |
|
271 | **Note:** It retries only on the specified methods, status codes, and on these network errors:
|
272 | - `ETIMEDOUT`: One of the [timeout](#timeout) limits were reached.
|
273 | - `ECONNRESET`: Connection was forcibly closed by a peer.
|
274 | - `EADDRINUSE`: Could not bind to any free port.
|
275 | - `ECONNREFUSED`: Connection was refused by the server.
|
276 | - `EPIPE`: The remote side of the stream being written has been closed.
|
277 |
|
278 | ###### followRedirect
|
279 |
|
280 | Type: `boolean`<br>
|
281 | Default: `true`
|
282 |
|
283 | Defines if redirect responses should be followed automatically.
|
284 |
|
285 | Note that if a `303` is sent by the server in response to any request type (`POST`, `DELETE`, etc.), Got will automatically request the resource pointed to in the location header via `GET`. This is in accordance with [the spec](https://tools.ietf.org/html/rfc7231#section-6.4.4).
|
286 |
|
287 | ###### decompress
|
288 |
|
289 | Type: `boolean`<br>
|
290 | Default: `true`
|
291 |
|
292 | Decompress the response automatically. This will set the `accept-encoding` header to `gzip, deflate` unless you set it yourself.
|
293 |
|
294 | If this is disabled, a compressed response is returned as a `Buffer`. This may be useful if you want to handle decompression yourself or stream the raw compressed data.
|
295 |
|
296 | ###### cache
|
297 |
|
298 | Type: `Object`<br>
|
299 | Default: `false`
|
300 |
|
301 | [Cache adapter instance](#cache-adapters) for storing cached data.
|
302 |
|
303 | ###### request
|
304 |
|
305 | Type: `Function`<br>
|
306 | Default: `http.request` `https.request` *(depending on the protocol)*
|
307 |
|
308 | Custom request function. The main purpose of this is to [support HTTP2 using a wrapper](#experimental-http2-support).
|
309 |
|
310 | ###### useElectronNet
|
311 |
|
312 | Type: `boolean`<br>
|
313 | Default: `false`
|
314 |
|
315 | When used in Electron, Got will use [`electron.net`](https://electronjs.org/docs/api/net/) instead of the Node.js `http` module. According to the Electron docs, it should be fully compatible, but it's not entirely. See [#443](https://github.com/sindresorhus/got/issues/443) and [#461](https://github.com/sindresorhus/got/issues/461).
|
316 |
|
317 | ###### throwHttpErrors
|
318 |
|
319 | Type: `boolean`<br>
|
320 | Default: `true`
|
321 |
|
322 | Determines if a `got.HTTPError` is thrown for error responses (non-2xx status codes).
|
323 |
|
324 | If this is disabled, requests that encounter an error status code will be resolved with the `response` instead of throwing. This may be useful if you are checking for resource availability and are expecting error responses.
|
325 |
|
326 | ###### agent
|
327 |
|
328 | Same as the [`agent` option](https://nodejs.org/api/http.html#http_http_request_url_options_callback) for `http.request`, but with an extra feature:
|
329 |
|
330 | If you require different agents for different protocols, you can pass a map of agents to the `agent` option. This is necessary because a request to one protocol might redirect to another. In such a scenario, Got will switch over to the right protocol agent for you.
|
331 |
|
332 | ```js
|
333 | const got = require('got');
|
334 | const HttpAgent = require('agentkeepalive');
|
335 | const {HttpsAgent} = HttpAgent;
|
336 |
|
337 | got('sindresorhus.com', {
|
338 | agent: {
|
339 | http: new HttpAgent(),
|
340 | https: new HttpsAgent()
|
341 | }
|
342 | });
|
343 | ```
|
344 |
|
345 | ###### hooks
|
346 |
|
347 | Type: `Object<string, Function[]>`
|
348 |
|
349 | Hooks allow modifications during the request lifecycle. Hook functions may be async and are run serially.
|
350 |
|
351 | ###### hooks.beforeRequest
|
352 |
|
353 | Type: `Function[]`<br>
|
354 | Default: `[]`
|
355 |
|
356 | Called with [normalized](source/normalize-arguments.js) [request options](#options). Got will make no further changes to the request before it is sent. This is especially useful in conjunction with [`got.extend()`](#instances) and [`got.create()`](advanced-creation.md) when you want to create an API client that, for example, uses HMAC-signing.
|
357 |
|
358 | See the [AWS section](#aws) for an example.
|
359 |
|
360 | **Note**: If you modify the `body` you will need to modify the `content-length` header too, because it has already been computed and assigned.
|
361 |
|
362 | ###### hooks.beforeRedirect
|
363 |
|
364 | Type: `Function[]`<br>
|
365 | Default: `[]`
|
366 |
|
367 | Called with [normalized](source/normalize-arguments.js) [request options](#options). Got will make no further changes to the request. This is especially useful when you want to avoid dead sites. Example:
|
368 |
|
369 | ```js
|
370 | const got = require('got');
|
371 |
|
372 | got('example.com', {
|
373 | hooks: {
|
374 | beforeRedirect: [
|
375 | options => {
|
376 | if (options.hostname === 'deadSite') {
|
377 | options.hostname = 'fallbackSite';
|
378 | }
|
379 | }
|
380 | ]
|
381 | }
|
382 | });
|
383 | ```
|
384 |
|
385 | ###### hooks.beforeRetry
|
386 |
|
387 | Type: `Function[]`<br>
|
388 | Default: `[]`
|
389 |
|
390 | Called with [normalized](source/normalize-arguments.js) [request options](#options), the error and the retry count. Got will make no further changes to the request. This is especially useful when some extra work is required before the next try. Example:
|
391 |
|
392 | ```js
|
393 | const got = require('got');
|
394 |
|
395 | got('example.com', {
|
396 | hooks: {
|
397 | beforeRetry: [
|
398 | (options, error, retryCount) => {
|
399 | if (error.statusCode === 413) { // Payload too large
|
400 | options.body = getNewBody();
|
401 | }
|
402 | }
|
403 | ]
|
404 | }
|
405 | });
|
406 | ```
|
407 |
|
408 | ###### hooks.afterResponse
|
409 |
|
410 | Type: `Function[]`<br>
|
411 | Default: `[]`
|
412 |
|
413 | Called with [response object](#response) and a retry function.
|
414 |
|
415 | Each function should return the response. This is especially useful when you want to refresh an access token. Example:
|
416 |
|
417 | ```js
|
418 | const got = require('got');
|
419 |
|
420 | const instance = got.extend({
|
421 | hooks: {
|
422 | afterResponse: [
|
423 | (response, retryWithMergedOptions) => {
|
424 | if (response.statusCode === 401) { // Unauthorized
|
425 | const updatedOptions = {
|
426 | headers: {
|
427 | token: getNewToken() // Refresh the access token
|
428 | }
|
429 | };
|
430 |
|
431 | // Save for further requests
|
432 | instance.defaults.options = got.mergeOptions(instance.defaults.options, updatedOptions);
|
433 |
|
434 | // Make a new retry
|
435 | return retryWithMergedOptions(updatedOptions);
|
436 | }
|
437 |
|
438 | // No changes otherwise
|
439 | return response;
|
440 | }
|
441 | ]
|
442 | },
|
443 | mutableDefaults: true
|
444 | });
|
445 | ```
|
446 |
|
447 | #### Response
|
448 |
|
449 | The response object will typically be a [Node.js HTTP response stream](https://nodejs.org/api/http.html#http_class_http_incomingmessage), however, if returned from the cache it will be a [response-like object](https://github.com/lukechilds/responselike) which behaves in the same way.
|
450 |
|
451 | ##### body
|
452 |
|
453 | Type: `string` `Object` *(depending on `options.json`)*
|
454 |
|
455 | The result of the request.
|
456 |
|
457 | ##### url
|
458 |
|
459 | Type: `string`
|
460 |
|
461 | The request URL or the final URL after redirects.
|
462 |
|
463 | ##### requestUrl
|
464 |
|
465 | Type: `string`
|
466 |
|
467 | The original request URL.
|
468 |
|
469 | ##### timings
|
470 |
|
471 | Type: `Object`
|
472 |
|
473 | The object contains the following properties:
|
474 |
|
475 | - `start` - Time when the request started.
|
476 | - `socket` - Time when a socket was assigned to the request.
|
477 | - `lookup` - Time when the DNS lookup finished.
|
478 | - `connect` - Time when the socket successfully connected.
|
479 | - `upload` - Time when the request finished uploading.
|
480 | - `response` - Time when the request fired the `response` event.
|
481 | - `end` - Time when the response fired the `end` event.
|
482 | - `error` - Time when the request fired the `error` event.
|
483 | - `phases`
|
484 | - `wait` - `timings.socket - timings.start`
|
485 | - `dns` - `timings.lookup - timings.socket`
|
486 | - `tcp` - `timings.connect - timings.lookup`
|
487 | - `request` - `timings.upload - timings.connect`
|
488 | - `firstByte` - `timings.response - timings.upload`
|
489 | - `download` - `timings.end - timings.response`
|
490 | - `total` - `timings.end - timings.start` or `timings.error - timings.start`
|
491 |
|
492 | **Note**: The time is a `number` representing the milliseconds elapsed since the UNIX epoch.
|
493 |
|
494 | ##### fromCache
|
495 |
|
496 | Type: `boolean`
|
497 |
|
498 | Whether the response was retrieved from the cache.
|
499 |
|
500 | ##### redirectUrls
|
501 |
|
502 | Type: `Array`
|
503 |
|
504 | The redirect URLs.
|
505 |
|
506 | ##### retryCount
|
507 |
|
508 | Type: `number`
|
509 |
|
510 | The number of times the request was retried.
|
511 |
|
512 | #### Streams
|
513 |
|
514 | **Note**: Progress events, redirect events and request/response events can also be used with promises.
|
515 |
|
516 | #### got.stream(url, [options])
|
517 |
|
518 | Sets `options.stream` to `true`.
|
519 |
|
520 | Returns a [duplex stream](https://nodejs.org/api/stream.html#stream_class_stream_duplex) with additional events:
|
521 |
|
522 | ##### .on('request', request)
|
523 |
|
524 | `request` event to get the request object of the request.
|
525 |
|
526 | **Tip**: You can use `request` event to abort request:
|
527 |
|
528 | ```js
|
529 | got.stream('github.com')
|
530 | .on('request', request => setTimeout(() => request.abort(), 50));
|
531 | ```
|
532 |
|
533 | ##### .on('response', response)
|
534 |
|
535 | The `response` event to get the response object of the final request.
|
536 |
|
537 | ##### .on('redirect', response, nextOptions)
|
538 |
|
539 | The `redirect` event to get the response object of a redirect. The second argument is options for the next request to the redirect location.
|
540 |
|
541 | ##### .on('uploadProgress', progress)
|
542 | ##### .on('downloadProgress', progress)
|
543 |
|
544 | Progress events for uploading (sending a request) and downloading (receiving a response). The `progress` argument is an object like:
|
545 |
|
546 | ```js
|
547 | {
|
548 | percent: 0.1,
|
549 | transferred: 1024,
|
550 | total: 10240
|
551 | }
|
552 | ```
|
553 |
|
554 | If it's not possible to retrieve the body size (can happen when streaming), `total` will be `null`.
|
555 |
|
556 | ```js
|
557 | (async () => {
|
558 | const response = await got('sindresorhus.com')
|
559 | .on('downloadProgress', progress => {
|
560 | // Report download progress
|
561 | })
|
562 | .on('uploadProgress', progress => {
|
563 | // Report upload progress
|
564 | });
|
565 |
|
566 | console.log(response);
|
567 | })();
|
568 | ```
|
569 |
|
570 | ##### .on('error', error, body, response)
|
571 |
|
572 | The `error` event emitted in case of a protocol error (like `ENOTFOUND` etc.) or status error (4xx or 5xx). The second argument is the body of the server response in case of status error. The third argument is a response object.
|
573 |
|
574 | #### got.get(url, [options])
|
575 | #### got.post(url, [options])
|
576 | #### got.put(url, [options])
|
577 | #### got.patch(url, [options])
|
578 | #### got.head(url, [options])
|
579 | #### got.delete(url, [options])
|
580 |
|
581 | Sets `options.method` to the method name and makes a request.
|
582 |
|
583 | ### Instances
|
584 |
|
585 | #### got.extend([options])
|
586 |
|
587 | Configure a new `got` instance with default `options`. `options` are merged with the parent instance's `defaults.options` using [`got.mergeOptions`](#gotmergeoptionsparentoptions-newoptions).
|
588 |
|
589 | ```js
|
590 | const client = got.extend({
|
591 | baseUrl: 'https://example.com',
|
592 | headers: {
|
593 | 'x-unicorn': 'rainbow'
|
594 | }
|
595 | });
|
596 |
|
597 | client.get('/demo');
|
598 |
|
599 | /* HTTP Request =>
|
600 | * GET /demo HTTP/1.1
|
601 | * Host: example.com
|
602 | * x-unicorn: rainbow
|
603 | */
|
604 | ```
|
605 |
|
606 | ```js
|
607 | (async () => {
|
608 | const client = got.extend({
|
609 | baseUrl: 'httpbin.org',
|
610 | headers: {
|
611 | 'x-foo': 'bar'
|
612 | }
|
613 | });
|
614 | const {headers} = (await client.get('/headers', {json: true})).body;
|
615 | //=> headers['x-foo'] === 'bar'
|
616 |
|
617 | const jsonClient = client.extend({
|
618 | json: true,
|
619 | headers: {
|
620 | 'x-baz': 'qux'
|
621 | }
|
622 | });
|
623 | const {headers: headers2} = (await jsonClient.get('/headers')).body;
|
624 | //=> headers2['x-foo'] === 'bar'
|
625 | //=> headers2['x-baz'] === 'qux'
|
626 | })();
|
627 | ```
|
628 |
|
629 | *Need more control over the behavior of Got? Check out the [`got.create()`](advanced-creation.md).*
|
630 |
|
631 | #### got.mergeOptions(parentOptions, newOptions)
|
632 |
|
633 | Extends parent options. Avoid using [object spread](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax#Spread_in_object_literals) as it doesn't work recursively:
|
634 |
|
635 | ```js
|
636 | const a = {headers: {cat: 'meow', wolf: ['bark', 'wrrr']}};
|
637 | const b = {headers: {cow: 'moo', wolf: ['auuu']}};
|
638 |
|
639 | {...a, ...b} // => {headers: {cow: 'moo', wolf: ['auuu']}}
|
640 | got.mergeOptions(a, b) // => {headers: {cat: 'meow', cow: 'moo', wolf: ['auuu']}}
|
641 | ```
|
642 |
|
643 | Options are deeply merged to a new object. The value of each key is determined as follows:
|
644 |
|
645 | - If the new property is set to `undefined`, it keeps the old one.
|
646 | - If the parent property is an instance of `URL` and the new value is a `string` or `URL`, a new URL instance is created: [`new URL(new, parent)`](https://developer.mozilla.org/en-US/docs/Web/API/URL/URL#Syntax).
|
647 | - If the new property is a plain `Object`:
|
648 | - If the parent property is a plain `Object` too, both values are merged recursively into a new `Object`.
|
649 | - Otherwise, only the new value is deeply cloned.
|
650 | - If the new property is an `Array`, it overwrites the old one with a deep clone of the new property.
|
651 | - Otherwise, the new value is assigned to the key.
|
652 |
|
653 | ## Errors
|
654 |
|
655 | Each error contains (if available) `body`, `statusCode`, `statusMessage`, `host`, `hostname`, `method`, `path`, `protocol` and `url` properties to make debugging easier.
|
656 |
|
657 | In Promise mode, the `response` is attached to the error.
|
658 |
|
659 | #### got.CacheError
|
660 |
|
661 | When a cache method fails, for example, if the database goes down or there's a filesystem error.
|
662 |
|
663 | #### got.RequestError
|
664 |
|
665 | When a request fails. Contains a `code` property with error class code, like `ECONNREFUSED`.
|
666 |
|
667 | #### got.ReadError
|
668 |
|
669 | When reading from response stream fails.
|
670 |
|
671 | #### got.ParseError
|
672 |
|
673 | When `json` option is enabled, server response code is 2xx, and `JSON.parse` fails.
|
674 |
|
675 | #### got.HTTPError
|
676 |
|
677 | When the server response code is not 2xx. Includes `statusCode`, `statusMessage`, and `redirectUrls` properties.
|
678 |
|
679 | #### got.MaxRedirectsError
|
680 |
|
681 | When the server redirects you more than ten times. Includes a `redirectUrls` property, which is an array of the URLs Got was redirected to before giving up.
|
682 |
|
683 | #### got.UnsupportedProtocolError
|
684 |
|
685 | When given an unsupported protocol.
|
686 |
|
687 | #### got.CancelError
|
688 |
|
689 | When the request is aborted with `.cancel()`.
|
690 |
|
691 | #### got.TimeoutError
|
692 |
|
693 | When the request is aborted due to a [timeout](#timeout)
|
694 |
|
695 | ## Aborting the request
|
696 |
|
697 | The promise returned by Got has a [`.cancel()`](https://github.com/sindresorhus/p-cancelable) method which when called, aborts the request.
|
698 |
|
699 | ```js
|
700 | (async () => {
|
701 | const request = got(url, options);
|
702 |
|
703 | // …
|
704 |
|
705 | // In another part of the code
|
706 | if (something) {
|
707 | request.cancel();
|
708 | }
|
709 |
|
710 | // …
|
711 |
|
712 | try {
|
713 | await request;
|
714 | } catch (error) {
|
715 | if (request.isCanceled) { // Or `error instanceof got.CancelError`
|
716 | // Handle cancelation
|
717 | }
|
718 |
|
719 | // Handle other errors
|
720 | }
|
721 | })();
|
722 | ```
|
723 |
|
724 | <a name="cache-adapters"></a>
|
725 | ## Cache
|
726 |
|
727 | Got implements [RFC 7234](http://httpwg.org/specs/rfc7234.html) compliant HTTP caching which works out of the box in-memory and is easily pluggable with a wide range of storage adapters. Fresh cache entries are served directly from the cache, and stale cache entries are revalidated with `If-None-Match`/`If-Modified-Since` headers. You can read more about the underlying cache behavior in the [`cacheable-request` documentation](https://github.com/lukechilds/cacheable-request).
|
728 |
|
729 | You can use the JavaScript `Map` type as an in-memory cache:
|
730 |
|
731 | ```js
|
732 | const got = require('got');
|
733 | const map = new Map();
|
734 |
|
735 | (async () => {
|
736 | let response = await got('sindresorhus.com', {cache: map});
|
737 | console.log(response.fromCache);
|
738 | //=> false
|
739 |
|
740 | response = await got('sindresorhus.com', {cache: map});
|
741 | console.log(response.fromCache);
|
742 | //=> true
|
743 | })();
|
744 | ```
|
745 |
|
746 | Got uses [Keyv](https://github.com/lukechilds/keyv) internally to support a wide range of storage adapters. For something more scalable you could use an [official Keyv storage adapter](https://github.com/lukechilds/keyv#official-storage-adapters):
|
747 |
|
748 | ```
|
749 | $ npm install @keyv/redis
|
750 | ```
|
751 |
|
752 | ```js
|
753 | const got = require('got');
|
754 | const KeyvRedis = require('@keyv/redis');
|
755 |
|
756 | const redis = new KeyvRedis('redis://user:pass@localhost:6379');
|
757 |
|
758 | got('sindresorhus.com', {cache: redis});
|
759 | ```
|
760 |
|
761 | Got supports anything that follows the Map API, so it's easy to write your own storage adapter or use a third-party solution.
|
762 |
|
763 | For example, the following are all valid storage adapters:
|
764 |
|
765 | ```js
|
766 | const storageAdapter = new Map();
|
767 | // Or
|
768 | const storageAdapter = require('./my-storage-adapter');
|
769 | // Or
|
770 | const QuickLRU = require('quick-lru');
|
771 | const storageAdapter = new QuickLRU({maxSize: 1000});
|
772 |
|
773 | got('sindresorhus.com', {cache: storageAdapter});
|
774 | ```
|
775 |
|
776 | View the [Keyv docs](https://github.com/lukechilds/keyv) for more information on how to use storage adapters.
|
777 |
|
778 |
|
779 | ## Proxies
|
780 |
|
781 | You can use the [`tunnel`](https://github.com/koichik/node-tunnel) package with the `agent` option to work with proxies:
|
782 |
|
783 | ```js
|
784 | const got = require('got');
|
785 | const tunnel = require('tunnel');
|
786 |
|
787 | got('sindresorhus.com', {
|
788 | agent: tunnel.httpOverHttp({
|
789 | proxy: {
|
790 | host: 'localhost'
|
791 | }
|
792 | })
|
793 | });
|
794 | ```
|
795 |
|
796 | Check out [`global-tunnel`](https://github.com/np-maintain/global-tunnel) if you want to configure proxy support for all HTTP/HTTPS traffic in your app.
|
797 |
|
798 |
|
799 | ## Cookies
|
800 |
|
801 | You can use the [`tough-cookie`](https://github.com/salesforce/tough-cookie) package:
|
802 |
|
803 | ```js
|
804 | const got = require('got');
|
805 | const {CookieJar} = require('tough-cookie');
|
806 |
|
807 | const cookieJar = new CookieJar();
|
808 | cookieJar.setCookie('foo=bar', 'https://www.google.com');
|
809 |
|
810 | got('google.com', {cookieJar});
|
811 | ```
|
812 |
|
813 |
|
814 | ## Form data
|
815 |
|
816 | You can use the [`form-data`](https://github.com/form-data/form-data) package to create POST request with form data:
|
817 |
|
818 | ```js
|
819 | const fs = require('fs');
|
820 | const got = require('got');
|
821 | const FormData = require('form-data');
|
822 | const form = new FormData();
|
823 |
|
824 | form.append('my_file', fs.createReadStream('/foo/bar.jpg'));
|
825 |
|
826 | got.post('google.com', {
|
827 | body: form
|
828 | });
|
829 | ```
|
830 |
|
831 |
|
832 | ## OAuth
|
833 |
|
834 | You can use the [`oauth-1.0a`](https://github.com/ddo/oauth-1.0a) package to create a signed OAuth request:
|
835 |
|
836 | ```js
|
837 | const got = require('got');
|
838 | const crypto = require('crypto');
|
839 | const OAuth = require('oauth-1.0a');
|
840 |
|
841 | const oauth = OAuth({
|
842 | consumer: {
|
843 | key: process.env.CONSUMER_KEY,
|
844 | secret: process.env.CONSUMER_SECRET
|
845 | },
|
846 | signature_method: 'HMAC-SHA1',
|
847 | hash_function: (baseString, key) => crypto.createHmac('sha1', key).update(baseString).digest('base64')
|
848 | });
|
849 |
|
850 | const token = {
|
851 | key: process.env.ACCESS_TOKEN,
|
852 | secret: process.env.ACCESS_TOKEN_SECRET
|
853 | };
|
854 |
|
855 | const url = 'https://api.twitter.com/1.1/statuses/home_timeline.json';
|
856 |
|
857 | got(url, {
|
858 | headers: oauth.toHeader(oauth.authorize({url, method: 'GET'}, token)),
|
859 | json: true
|
860 | });
|
861 | ```
|
862 |
|
863 |
|
864 | ## Unix Domain Sockets
|
865 |
|
866 | Requests can also be sent via [unix domain sockets](http://serverfault.com/questions/124517/whats-the-difference-between-unix-socket-and-tcp-ip-socket). Use the following URL scheme: `PROTOCOL://unix:SOCKET:PATH`.
|
867 |
|
868 | - `PROTOCOL` - `http` or `https` *(optional)*
|
869 | - `SOCKET` - Absolute path to a unix domain socket, for example: `/var/run/docker.sock`
|
870 | - `PATH` - Request path, for example: `/v2/keys`
|
871 |
|
872 | ```js
|
873 | got('http://unix:/var/run/docker.sock:/containers/json');
|
874 |
|
875 | // Or without protocol (HTTP by default)
|
876 | got('unix:/var/run/docker.sock:/containers/json');
|
877 | ```
|
878 |
|
879 |
|
880 | ## AWS
|
881 |
|
882 | Requests to AWS services need to have their headers signed. This can be accomplished by using the [`aws4`](https://www.npmjs.com/package/aws4) package. This is an example for querying an ["API Gateway"](https://docs.aws.amazon.com/apigateway/api-reference/signing-requests/) with a signed request.
|
883 |
|
884 | ```js
|
885 | const AWS = require('aws-sdk');
|
886 | const aws4 = require('aws4');
|
887 | const got = require('got');
|
888 |
|
889 | const chain = new AWS.CredentialProviderChain();
|
890 |
|
891 | // Create a Got instance to use relative paths and signed requests
|
892 | const awsClient = got.extend({
|
893 | baseUrl: 'https://<api-id>.execute-api.<api-region>.amazonaws.com/<stage>/',
|
894 | hooks: {
|
895 | beforeRequest: [
|
896 | async options => {
|
897 | const credentials = await chain.resolvePromise();
|
898 | aws4.sign(options, credentials);
|
899 | }
|
900 | ]
|
901 | }
|
902 | });
|
903 |
|
904 | const response = await awsClient('endpoint/path', {
|
905 | // Request-specific options
|
906 | });
|
907 | ```
|
908 |
|
909 |
|
910 | ## Testing
|
911 |
|
912 | You can test your requests by using the [`nock`](https://github.com/node-nock/nock) package to mock an endpoint:
|
913 |
|
914 | ```js
|
915 | const got = require('got');
|
916 | const nock = require('nock');
|
917 |
|
918 | nock('https://sindresorhus.com')
|
919 | .get('/')
|
920 | .reply(200, 'Hello world!');
|
921 |
|
922 | (async () => {
|
923 | const response = await got('sindresorhus.com');
|
924 | console.log(response.body);
|
925 | //=> 'Hello world!'
|
926 | })();
|
927 | ```
|
928 |
|
929 | If you need real integration tests you can use [`create-test-server`](https://github.com/lukechilds/create-test-server):
|
930 |
|
931 | ```js
|
932 | const got = require('got');
|
933 | const createTestServer = require('create-test-server');
|
934 |
|
935 | (async () => {
|
936 | const server = await createTestServer();
|
937 | server.get('/', 'Hello world!');
|
938 |
|
939 | const response = await got(server.url);
|
940 | console.log(response.body);
|
941 | //=> 'Hello world!'
|
942 |
|
943 | await server.close();
|
944 | })();
|
945 | ```
|
946 |
|
947 |
|
948 | ## Tips
|
949 |
|
950 | ### User Agent
|
951 |
|
952 | It's a good idea to set the `'user-agent'` header so the provider can more easily see how their resource is used. By default, it's the URL to this repo. You can omit this header by setting it to `null`.
|
953 |
|
954 | ```js
|
955 | const got = require('got');
|
956 | const pkg = require('./package.json');
|
957 |
|
958 | got('sindresorhus.com', {
|
959 | headers: {
|
960 | 'user-agent': `my-package/${pkg.version} (https://github.com/username/my-package)`
|
961 | }
|
962 | });
|
963 |
|
964 | got('sindresorhus.com', {
|
965 | headers: {
|
966 | 'user-agent': null
|
967 | }
|
968 | });
|
969 | ```
|
970 |
|
971 | ### 304 Responses
|
972 |
|
973 | Bear in mind; if you send an `if-modified-since` header and receive a `304 Not Modified` response, the body will be empty. It's your responsibility to cache and retrieve the body contents.
|
974 |
|
975 | ### Custom endpoints
|
976 |
|
977 | Use `got.extend()` to make it nicer to work with REST APIs. Especially if you use the `baseUrl` option.
|
978 |
|
979 | **Note:** Not to be confused with [`got.create()`](advanced-creation.md), which has no defaults.
|
980 |
|
981 | ```js
|
982 | const got = require('got');
|
983 | const pkg = require('./package.json');
|
984 |
|
985 | const custom = got.extend({
|
986 | baseUrl: 'example.com',
|
987 | json: true,
|
988 | headers: {
|
989 | 'user-agent': `my-package/${pkg.version} (https://github.com/username/my-package)`
|
990 | }
|
991 | });
|
992 |
|
993 | // Use `custom` exactly how you use `got`
|
994 | (async () => {
|
995 | const list = await custom('/v1/users/list');
|
996 | })();
|
997 | ```
|
998 |
|
999 | *Need to merge some instances into a single one? Check out [`got.mergeInstances()`](advanced-creation.md#merging-instances).*
|
1000 |
|
1001 | ### Experimental HTTP2 support
|
1002 |
|
1003 | Got provides an experimental support for HTTP2 using the [`http2-wrapper`](https://github.com/szmarczak/http2-wrapper) package:
|
1004 |
|
1005 | ```js
|
1006 | const got = require('got');
|
1007 | const {request} = require('http2-wrapper');
|
1008 |
|
1009 | const h2got = got.extend({request});
|
1010 |
|
1011 | (async () => {
|
1012 | const {body} = await h2got('https://nghttp2.org/httpbin/headers');
|
1013 | console.log(body);
|
1014 | })();
|
1015 | ```
|
1016 |
|
1017 | ## Comparison
|
1018 |
|
1019 | | | `got` | `request` | `node-fetch` | `axios` |
|
1020 | |-----------------------|:------------:|:------------:|:------------:|:------------:|
|
1021 | | HTTP/2 support | ❔ | ✖ | ✖ | ✖ |
|
1022 | | Browser support | ✖ | ✖ | ✔* | ✔ |
|
1023 | | Electron support | ✔ | ✖ | ✖ | ✖ |
|
1024 | | Promise API | ✔ | ✔ | ✔ | ✔ |
|
1025 | | Stream API | ✔ | ✔ | Node.js only | ✖ |
|
1026 | | Request cancelation | ✔ | ✖ | ✖ | ✔ |
|
1027 | | RFC compliant caching | ✔ | ✖ | ✖ | ✖ |
|
1028 | | Cookies (out-of-box) | ✔ | ✔ | ✖ | ✖ |
|
1029 | | Follows redirects | ✔ | ✔ | ✔ | ✔ |
|
1030 | | Retries on failure | ✔ | ✖ | ✖ | ✖ |
|
1031 | | Progress events | ✔ | ✖ | ✖ | Browser only |
|
1032 | | Handles gzip/deflate | ✔ | ✔ | ✔ | ✔ |
|
1033 | | Advanced timeouts | ✔ | ✖ | ✖ | ✖ |
|
1034 | | Timings | ✔ | ✔ | ✖ | ✖ |
|
1035 | | Errors with metadata | ✔ | ✖ | ✖ | ✔ |
|
1036 | | JSON mode | ✔ | ✔ | ✖ | ✔ |
|
1037 | | Custom defaults | ✔ | ✔ | ✖ | ✔ |
|
1038 | | Composable | ✔ | ✖ | ✖ | ✖ |
|
1039 | | Hooks | ✔ | ✖ | ✖ | ✔ |
|
1040 | | Issues open | ![][gio] | ![][rio] | ![][nio] | ![][aio] |
|
1041 | | Issues closed | ![][gic] | ![][ric] | ![][nic] | ![][aic] |
|
1042 | | Downloads | ![][gd] | ![][rd] | ![][nd] | ![][ad] |
|
1043 | | Coverage | ![][gc] | ![][rc] | ![][nc] | ![][ac] |
|
1044 | | Build | ![][gb] | ![][rb] | ![][nb] | ![][ab] |
|
1045 | | Bugs | ![][gbg] | ![][rbg] | ![][nbg] | ![][abg] |
|
1046 | | Dependents | ![][gdp] | ![][rdp] | ![][ndp] | ![][adp] |
|
1047 | | Install size | ![][gis] | ![][ris] | ![][nis] | ![][ais] |
|
1048 |
|
1049 | \* It's almost API compatible with the browser `fetch` API.<br>
|
1050 | ❔ Experimental support.
|
1051 |
|
1052 |
|
1053 | [gio]: https://img.shields.io/github/issues/sindresorhus/got.svg
|
1054 | [rio]: https://img.shields.io/github/issues/request/request.svg
|
1055 | [nio]: https://img.shields.io/github/issues/bitinn/node-fetch.svg
|
1056 | [aio]: https://img.shields.io/github/issues/axios/axios.svg
|
1057 |
|
1058 |
|
1059 | [gic]: https://img.shields.io/github/issues-closed/sindresorhus/got.svg
|
1060 | [ric]: https://img.shields.io/github/issues-closed/request/request.svg
|
1061 | [nic]: https://img.shields.io/github/issues-closed/bitinn/node-fetch.svg
|
1062 | [aic]: https://img.shields.io/github/issues-closed/axios/axios.svg
|
1063 |
|
1064 |
|
1065 | [gd]: https://img.shields.io/npm/dm/got.svg
|
1066 | [rd]: https://img.shields.io/npm/dm/request.svg
|
1067 | [nd]: https://img.shields.io/npm/dm/node-fetch.svg
|
1068 | [ad]: https://img.shields.io/npm/dm/axios.svg
|
1069 |
|
1070 |
|
1071 | [gc]: https://coveralls.io/repos/github/sindresorhus/got/badge.svg?branch=master
|
1072 | [rc]: https://coveralls.io/repos/github/request/request/badge.svg?branch=master
|
1073 | [nc]: https://coveralls.io/repos/github/bitinn/node-fetch/badge.svg?branch=master
|
1074 | [ac]: https://coveralls.io/repos/github/mzabriskie/axios/badge.svg?branch=master
|
1075 |
|
1076 |
|
1077 | [gb]: https://travis-ci.org/sindresorhus/got.svg?branch=master
|
1078 | [rb]: https://travis-ci.org/request/request.svg?branch=master
|
1079 | [nb]: https://travis-ci.org/bitinn/node-fetch.svg?branch=master
|
1080 | [ab]: https://travis-ci.org/axios/axios.svg?branch=master
|
1081 |
|
1082 |
|
1083 | [gbg]: https://badgen.net/github/label-issues/sindresorhus/got/bug/open
|
1084 | [rbg]: https://badgen.net/github/label-issues/request/request/Needs%20investigation/open
|
1085 | [nbg]: https://badgen.net/github/label-issues/bitinn/node-fetch/bug/open
|
1086 | [abg]: https://badgen.net/github/label-issues/axios/axios/bug/open
|
1087 |
|
1088 |
|
1089 | [gdp]: https://badgen.net/npm/dependents/got
|
1090 | [rdp]: https://badgen.net/npm/dependents/request
|
1091 | [ndp]: https://badgen.net/npm/dependents/node-fetch
|
1092 | [adp]: https://badgen.net/npm/dependents/axios
|
1093 |
|
1094 |
|
1095 | [gis]: https://packagephobia.now.sh/badge?p=got
|
1096 | [ris]: https://packagephobia.now.sh/badge?p=request
|
1097 | [nis]: https://packagephobia.now.sh/badge?p=node-fetch
|
1098 | [ais]: https://packagephobia.now.sh/badge?p=axios
|
1099 |
|
1100 |
|
1101 | ## Related
|
1102 |
|
1103 | - [gh-got](https://github.com/sindresorhus/gh-got) - Got convenience wrapper to interact with the GitHub API
|
1104 | - [gl-got](https://github.com/singapore/gl-got) - Got convenience wrapper to interact with the GitLab API
|
1105 | - [travis-got](https://github.com/samverschueren/travis-got) - Got convenience wrapper to interact with the Travis API
|
1106 | - [graphql-got](https://github.com/kevva/graphql-got) - Got convenience wrapper to interact with GraphQL
|
1107 | - [GotQL](https://github.com/khaosdoctor/gotql) - Got convenience wrapper to interact with GraphQL using JSON-parsed queries instead of strings
|
1108 |
|
1109 |
|
1110 | ## Maintainers
|
1111 |
|
1112 | [![Sindre Sorhus](https://github.com/sindresorhus.png?size=100)](https://sindresorhus.com) | [![Vsevolod Strukchinsky](https://github.com/floatdrop.png?size=100)](https://github.com/floatdrop) | [![Alexander Tesfamichael](https://github.com/AlexTes.png?size=100)](https://github.com/AlexTes) | [![Luke Childs](https://github.com/lukechilds.png?size=100)](https://github.com/lukechilds) | [![Szymon Marczak](https://github.com/szmarczak.png?size=100)](https://github.com/szmarczak) | [![Brandon Smith](https://github.com/brandon93s.png?size=100)](https://github.com/brandon93s)
|
1113 | ---|---|---|---|---|---
|
1114 | [Sindre Sorhus](https://sindresorhus.com) | [Vsevolod Strukchinsky](https://github.com/floatdrop) | [Alexander Tesfamichael](https://alextes.me) | [Luke Childs](https://github.com/lukechilds) | [Szymon Marczak](https://github.com/szmarczak) | [Brandon Smith](https://github.com/brandon93s)
|
1115 |
|
1116 |
|
1117 | ## License
|
1118 |
|
1119 | MIT
|