got
DefinitelyTyped icon, indicating that this package has TypeScript declarations provided by the separate @types/got package

14.4.7 • Public • Published


Got




Sindre's open source work is supported by the community.
Special thanks to:



Fame Helsinki Fame Helsinki








Human-friendly and powerful HTTP request library for Node.js

Downloads Install size

See how Got compares to other HTTP libraries


You probably want Ky instead, by the same people. It's smaller, works in the browser too, and is more stable since it's built on Fetch. Or fetch-extras for simple needs.


Support questions should be asked here.

Install

npm install got

Warning: This package is native ESM and no longer provides a CommonJS export. If your project uses CommonJS, you will have to convert to ESM. Please don't open issues for questions regarding CommonJS / ESM.

Got v11 is no longer maintained and we will not accept any backport requests.

Take a peek

A quick start guide is available.

JSON mode

Got has a dedicated option for handling JSON payload.
Furthermore, the promise exposes a .json<T>() function that returns Promise<T>.

import got from 'got';

const {data} = await got.post('https://httpbin.org/anything', {
	json: {
		hello: 'world'
	}
}).json();

console.log(data);
//=> {"hello": "world"}

For advanced JSON usage, check out the parseJson and stringifyJson options.

For more useful tips like this, visit the Tips page.

Highlights

Documentation

By default, Got will retry on failure. To disable this option, set options.retry.limit to 0.

Main API

Timeouts and retries

Advanced creation

Cache, Proxy and UNIX sockets

Integration


Migration guides

Got plugins

  • got4aws - Got convenience wrapper to interact with AWS v4 signed APIs
  • gh-got - Got convenience wrapper to interact with the GitHub API
  • gl-got - Got convenience wrapper to interact with the GitLab API
  • gotql - Got convenience wrapper to interact with GraphQL using JSON-parsed queries instead of strings
  • got-fetch - Got with a fetch interface
  • got-scraping - Got wrapper specifically designed for web scraping purposes
  • got-ssrf - Got wrapper to protect server-side requests against SSRF attacks

Comparison

got node-fetch ky axios superagent
HTTP/2 support ✔️¹ ✔️ ✔️**
Browser support ✔️* ✔️ ✔️ ✔️
Promise API ✔️ ✔️ ✔️ ✔️ ✔️
Stream API ✔️ Node.js only ✔️
Pagination API ✔️
Request cancelation ✔️ ✔️ ✔️ ✔️ ✔️
RFC compliant caching ✔️
Cookies (out-of-the-box) ✔️
Follows redirects ✔️ ✔️ ✔️ ✔️ ✔️
Retries on failure ✔️ ✔️ ✔️
Progress events ✔️ ✔️*** Browser only ✔️
Handles gzip/deflate ✔️ ✔️ ✔️ ✔️ ✔️
Advanced timeouts ✔️
Timings ✔️
Errors with metadata ✔️ ✔️ ✔️
JSON mode ✔️ ✔️ ✔️ ✔️ ✔️
Custom defaults ✔️ ✔️ ✔️
Composable ✔️ ✔️
Hooks ✔️ ✔️ ✔️
Issues open
Issues closed
Downloads
Coverage TBD
Build
Bugs
Dependents
Install size
GitHub stars
TypeScript support
Last commit

* It's almost API compatible with the browser fetch API.
** Need to switch the protocol manually. Doesn't accept PUSH streams and doesn't reuse HTTP/2 sessions.
*** Currently, only DownloadProgress event is supported, UploadProgress event is not supported.
¹ Requires Node.js 15.10.0 or above.
❇️ Almost-stable feature, but the API may change. Don't hesitate to try it out!
❔ Feature in early stage of development. Very experimental.

Click here to see the install size of the Got dependencies.

Maintainers

Sindre Sorhus Szymon Marczak
Sindre Sorhus Szymon Marczak

These amazing companies are using Got


Segment is a happy user of Got! Got powers the main backend API that our app talks to. It's used by our in-house RPC client that we use to communicate with all microservices.

Vadim Demedes

Antora, a static site generator for creating documentation sites, uses Got to download the UI bundle. In Antora, the UI bundle (aka theme) is maintained as a separate project. That project exports the UI as a zip file we call the UI bundle. The main site generator downloads that UI from a URL using Got and streams it to vinyl-zip to extract the files. Those files go on to be used to create the HTML pages and supporting assets.

Dan Allen

GetVoIP is happily using Got in production. One of the unique capabilities of Got is the ability to handle Unix sockets which enables us to build a full control interfaces for our docker stack.

Daniel Kalen

We're using Got inside of Exoframe to handle all the communication between CLI and server. Exoframe is a self-hosted tool that allows simple one-command deployments using Docker.

Tim Ermilov

Karaoke Mugen uses Got to fetch content updates from its online server.

Axel Terizaki

Renovate uses Got, gh-got and gl-got to send millions of queries per day to GitHub, GitLab, npmjs, PyPi, Packagist, Docker Hub, Terraform, CircleCI, and more.

Rhys Arkins

Resistbot uses Got to communicate from the API frontend where all correspondence ingresses to the officials lookup database in back.

Chris Erickson

Natural Cycles is using Got to communicate with all kinds of 3rd-party REST APIs (over 9000!).

Kirill Groshkov

Microlink is a cloud browser as an API service that uses Got widely as the main HTTP client, serving ~22M requests a month, every time a network call needs to be performed.

Kiko Beats

We’re using Got at Radity. Thanks for such an amazing work!

Mirzayev Farid

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
11.8.67,524,297version-11
14.4.7245,935latest

Version History

VersionDownloads (Last 7 Days)Published
14.4.7245,935
14.4.696,239
14.4.582,586
14.4.47,100
14.4.315,113
14.4.248,604
14.4.133,253
14.4.0418
14.3.07,339
14.2.117,382
14.2.04,440
14.1.01,338
14.0.010,893
13.0.01,363,689
12.6.12,084,233
12.6.0102,484
11.8.67,524,297
12.5.369,893
12.5.226,808
12.5.16,891
12.5.05,617
12.4.14,179
12.4.09
12.3.16,686
12.3.0771
12.2.0877
12.1.0202,781
11.8.5564,688
12.0.41,103
12.0.3609
12.0.2146
12.0.1383
12.0.0829
11.8.3181,536
12.0.0-beta.48
12.0.0-beta.35
12.0.0-beta.29
12.0.0-beta.16
11.8.2247,535
11.8.127,880
11.8.026,887
11.7.07,011
11.6.23,105
11.6.1449
11.6.03,682
11.5.29,588
11.5.14,835
11.5.01,656
11.4.07,740
11.3.04,816
11.2.0566
11.1.45,500
11.1.31,006
11.1.213
11.1.114
11.1.02,314
11.0.31,837
11.0.21,500
11.0.11,679
11.0.0334
11.0.0-beta.17
10.7.0350,688
10.6.04,077
10.5.71,052
10.5.68
10.5.545
10.5.47
10.5.38
10.5.235
10.5.15
10.5.07
10.4.021
10.3.051
10.2.284
10.2.1832
10.2.060
10.1.0182
10.0.4134
10.0.310
10.0.28
10.0.150
10.0.04,399
10.0.0-beta.37
10.0.0-beta.26
10.0.0-beta.18
10.0.0-alpha.3.29
10.0.0-alpha.3.16
10.0.0-alpha.2.283
10.0.0-alpha.2.112
10.0.0-alpha.26
10.0.0-alpha.1.17
9.6.04,064,014
9.5.170
9.5.0274
9.4.0139
9.3.2171
9.3.131
9.3.0184
9.2.2134
9.2.160
9.2.0170
9.1.015
9.0.0246
8.3.21,488,878
8.3.19,215
8.3.05,333
8.2.01,088
8.1.016
8.0.3323
8.0.282
8.0.1286
8.0.0999
7.1.0768,706
7.0.067
6.7.11,556,740
6.7.017
6.6.3487
6.6.26
5.7.197,334
6.6.18
6.6.05
5.7.09
6.5.052
6.3.066
5.6.062,003
5.5.110
5.5.028
6.2.025
5.4.29
6.1.216
6.1.126
5.4.123
6.1.07
5.4.017
6.0.26
5.3.228
5.3.1828
6.0.18
6.0.05
5.3.06
5.2.19
6.0.0-rc14
5.2.08
5.1.06
5.0.011
4.2.09,770
4.1.16
4.1.013
4.0.07
3.3.132,771
3.3.06
3.2.046
3.1.07
3.0.09
2.9.2831
2.9.15
2.9.08
2.8.17
2.8.07
2.7.21,172
2.7.16
2.7.019
2.6.08
2.5.08
2.4.024,377
2.3.25
2.3.18
2.3.07
2.2.010
2.1.010
2.0.08
1.2.247
1.2.18
1.2.06
1.1.08
1.0.16
1.0.07
0.3.013,115
0.2.07,159
0.1.19
0.1.04

Package Sidebar

Install

npm i got

Weekly Downloads

21,588,846

Version

14.4.7

License

MIT

Unpacked Size

242 kB

Total Files

45

Last publish

Collaborators

  • sindresorhus
  • szmarczak