Sindre's open source work is supported by the community.
Special thanks to:
All your favourite IDE's now available on the cloud
allowing you to code faster, better and on-the-go on your favourite IDEs like
Android Studio, VS Code, Jupyter and PyCharm using your browser.
All your favourite IDE's now available on the cloud
allowing you to code faster, better and on-the-go on your favourite IDEs like
Android Studio, VS Code, Jupyter and PyCharm using your browser.
Paperwork that makes the data work.
The easiest way to build paperwork automation into your product.
Paperwork that makes the data work.
The easiest way to build paperwork automation into your product.
Human-friendly and powerful HTTP request library for Node.js
See how Got compares to other HTTP libraries
For browser usage, we recommend Ky by the same people.
Support questions should be asked here.
npm install got
Warning: This package is native ESM and no longer provides a CommonJS export. If your project uses CommonJS, you'll have to convert to ESM or use the dynamic import()
function. Please don't open issues for questions regarding CommonJS / ESM. You can also use Got v11 instead which is pretty stable.
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.
got4aws
- Got convenience wrapper to interact with AWS v4 signed APIsgh-got
- Got convenience wrapper to interact with the GitHub APIgl-got
- Got convenience wrapper to interact with the GitLab APIgotql
- Got convenience wrapper to interact with GraphQL using JSON-parsed queries instead of stringsgot-fetch
- Got with afetch
interfacegot-scraping
- Got wrapper specifically designed for web scraping purposesgot-ssrf
- Got wrapper to protect server-side requests against SSRF attacks
- travis-got - Got convenience wrapper to interact with the Travis API
- graphql-got - Got convenience wrapper to interact with GraphQL
got |
request |
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-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.
Sindre Sorhus | Szymon Marczak |
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
Got has been a crucial component of Apify's scraping for years. We use it to extract data from billions of web pages every month, and we really appreciate the powerful API and extensibility, which allowed us to build our own specialized HTTP client on top of Got. The support has always been stellar too.
β Ondra Urban
Available as part of the Tidelift Subscription.
The maintainers of got
and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source dependencies you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact dependencies you use. Learn more.