๐ Human-friendly and powerful HTTP request library for Node.js
Installations
npm install got-cjs-compat
Developer Guide
Typescript
Yes
Module System
ESM
Min. Node Version
>=20
Node Version
20.15.1
NPM Version
10.8.3
Contributors
Unable to fetch Contributors
Languages
TypeScript (99.71%)
JavaScript (0.29%)
Developer
sevteen
Download Statistics
Total Downloads
3,775
Last Day
18
Last Week
259
Last Month
1,092
Last Year
3,775
GitHub Statistics
1 Stars
1,540 Commits
1 Forks
1 Watching
1 Branches
1 Contributors
Sponsor this package
Package Meta Information
Latest Version
14.4.5
Package Id
got-cjs-compat@14.4.5
Unpacked Size
870.01 kB
Size
179.43 kB
File Count
197
NPM Version
10.8.3
Node Version
20.15.1
Publised On
28 Oct 2024
Total Downloads
Cumulative downloads
Total Downloads
3,775
Last day
-62.5%
18
Compared to previous day
Last week
-7.8%
259
Compared to previous week
Last month
4.7%
1,092
Compared to previous month
Last year
0%
3,775
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
12
Dev Dependencies
47
Sindre's open source work is supported by the community.
Special thanks to:
Human-friendly and powerful HTTP request library for Node.js
See how Got compares to other HTTP libraries
A community-maintained fork of Got, designed for both CommonJS (CJS) and ECMAScript Module (ESM) compatibility. This repository was created independently from the original Got library to extend support across all versions of ECMAScript, ensuring smoother transitions for developers in both CJS and ESM environments. Got-CJS-Compat offers the same powerful HTTP request features as Got while making it easy for projects still using CJS to benefit from Gotโs core functionality.
Install
Replace in-place got
using npm install <alias>@npm:<name>
Note: This package supports both ESM and CJS environments. If your project uses CJS, thereโs no need to migrate to ESM to use Got with this library.
1npm install got@npm:got-cjs-compat
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>
.
1import got from 'got'; 2 3const {data} = await got.post('https://httpbin.org/anything', { 4 json: { 5 hello: 'world' 6 } 7}).json(); 8 9console.log(data); 10//=> {"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 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
Comparison
got | node-fetch | ky | axios | superagent | |
---|---|---|---|---|---|
HTTP/2 support | :heavy_check_mark:ยน | :x: | :heavy_check_mark: | :x: | :heavy_check_mark:** |
Browser support | :x: | :heavy_check_mark:* | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Promise API | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Stream API | :heavy_check_mark: | Node.js only | :x: | :x: | :heavy_check_mark: |
Pagination API | :heavy_check_mark: | :x: | :x: | :x: | :x: |
Request cancelation | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
RFC compliant caching | :heavy_check_mark: | :x: | :x: | :x: | :x: |
Cookies (out-of-the-box) | :heavy_check_mark: | :x: | :x: | :x: | :x: |
Follows redirects | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Retries on failure | :heavy_check_mark: | :x: | :heavy_check_mark: | :x: | :heavy_check_mark: |
Progress events | :heavy_check_mark: | :x: | :heavy_check_mark:*** | Browser only | :heavy_check_mark: |
Handles gzip/deflate | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Advanced timeouts | :heavy_check_mark: | :x: | :x: | :x: | :x: |
Timings | :heavy_check_mark: | :x: | :x: | :x: | :x: |
Errors with metadata | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
JSON mode | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: | :heavy_check_mark: |
Custom defaults | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
Composable | :heavy_check_mark: | :x: | :x: | :x: | :heavy_check_mark: |
Hooks | :heavy_check_mark: | :x: | :heavy_check_mark: | :heavy_check_mark: | :x: |
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.
:sparkle: Almost-stable feature, but the API may change. Don't hesitate to try it out!
:grey_question: Feature in early stage of development. Very experimental.
Click here to see the install size of the Got dependencies.
Maintainers
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
No vulnerabilities found.
No security vulnerabilities found.