got vs @hyper-fetch/core vs axios vs node-fetch
HTTP Request Libraries for Node.js
got@hyper-fetch/coreaxiosnode-fetchSimilar Packages:

HTTP Request Libraries for Node.js

HTTP request libraries are essential tools in web development that facilitate communication between a client and a server. They provide a simplified API for making HTTP requests, handling responses, and managing various aspects of network communication. These libraries help developers efficiently interact with RESTful APIs, handle asynchronous operations, and manage data retrieval and submission in web applications. The choice of library can significantly impact the ease of development, performance, and maintainability of the codebase.

Npm Package Weekly Downloads Trend

3 Years

Github Stars Ranking

Stat Detail

Package
Downloads
Stars
Size
Issues
Publish
License
got27,144,58314,877304 kB13 months agoMIT
@hyper-fetch/core2,4621,3271.44 MB112 months agoApache-2.0
axios0108,6532.42 MB34116 days agoMIT
node-fetch08,861107 kB2383 years agoMIT

Feature Comparison: got vs @hyper-fetch/core vs axios vs node-fetch

API Design

  • got:

    Got features a powerful API that supports advanced options such as hooks, retries, and streams. It is designed for flexibility and performance, allowing developers to customize requests extensively.

  • @hyper-fetch/core:

    @hyper-fetch/core offers a modern API that is designed with TypeScript in mind, providing type safety and better developer experience. It supports advanced features like caching and automatic retries, making it suitable for complex applications.

  • axios:

    Axios has a straightforward and easy-to-use API that is promise-based, making it accessible for developers familiar with JavaScript promises. It also provides interceptors for request and response manipulation, enhancing flexibility.

  • node-fetch:

    node-fetch mimics the Fetch API found in browsers, providing a familiar interface for web developers. Its minimalistic design is focused on simplicity, making it easy to use for basic HTTP requests.

Error Handling

  • got:

    Got offers advanced error handling capabilities, including automatic retries with customizable strategies. It also allows developers to hook into the request lifecycle to handle errors in a granular manner.

  • @hyper-fetch/core:

    @hyper-fetch/core includes built-in error handling mechanisms that allow developers to manage errors gracefully, including automatic retries for failed requests and customizable error responses.

  • axios:

    Axios provides a robust error handling system that allows developers to catch and handle errors at both the request and response levels. It also allows for custom error messages and handling based on status codes.

  • node-fetch:

    node-fetch provides basic error handling, primarily through promise rejection for network errors. It does not include built-in retry mechanisms, so developers need to implement custom error handling strategies.

Performance

  • got:

    Got is designed for performance, offering features like request streaming and efficient handling of large payloads. It is ideal for applications that require high performance and low latency.

  • @hyper-fetch/core:

    @hyper-fetch/core is optimized for performance with features like caching and efficient request handling, making it suitable for high-performance applications that require fast data retrieval.

  • axios:

    Axios is generally performant for most use cases, but it may not be as optimized for high-throughput scenarios compared to other libraries. It is suitable for standard applications with moderate performance requirements.

  • node-fetch:

    node-fetch is lightweight and performs well for simple use cases. However, it may lack some optimizations found in more feature-rich libraries, making it less suitable for high-performance applications.

Community and Support

  • got:

    Got has a dedicated community and is well-documented, providing ample resources for developers. Its advanced features are well-supported, making it a reliable choice for complex applications.

  • @hyper-fetch/core:

    @hyper-fetch/core is relatively new compared to others, so its community and support resources may be limited. However, it is gaining traction due to its modern features and TypeScript support.

  • axios:

    Axios has a large and active community, with extensive documentation and numerous tutorials available. This makes it easy to find support and resources for troubleshooting and learning.

  • node-fetch:

    node-fetch has a solid user base and is widely used in the Node.js ecosystem. Its documentation is clear, and there are many community resources available for support.

Learning Curve

  • got:

    Got has a steeper learning curve due to its extensive feature set and flexibility. Developers may need time to explore its capabilities and understand its advanced options.

  • @hyper-fetch/core:

    @hyper-fetch/core has a moderate learning curve, especially for those unfamiliar with TypeScript. Its advanced features may require some time to fully understand and utilize effectively.

  • axios:

    Axios is easy to learn, especially for developers familiar with JavaScript promises. Its straightforward API makes it accessible for beginners, while still offering powerful features for advanced users.

  • node-fetch:

    node-fetch is simple and easy to learn, especially for those already familiar with the Fetch API in browsers. Its minimalistic approach allows for quick adoption without much overhead.

How to Choose: got vs @hyper-fetch/core vs axios vs node-fetch

  • got:

    Choose Got if you require a powerful and flexible HTTP request library with advanced features like retries, hooks, and streams. It's particularly suited for complex use cases and offers a modern API with a focus on performance.

  • @hyper-fetch/core:

    Choose @hyper-fetch/core if you need a modern, type-safe solution that integrates seamlessly with TypeScript and offers advanced features like caching, automatic retries, and a focus on performance.

  • axios:

    Choose Axios for its simplicity and widespread adoption. It offers a promise-based API, built-in support for interceptors, and is well-documented, making it a great choice for both beginners and experienced developers.

  • node-fetch:

    Choose node-fetch if you want a lightweight and minimalistic library that closely follows the Fetch API standard in the browser. It's ideal for projects that prioritize simplicity and compatibility with existing Fetch API code.

README for got



Got




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



Fame Helsinki Fame Helsinki



Depot logo
Fast remote container builds and GitHub Actions runners.











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

gotnode-fetchkyaxiossuperagent
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
CoverageTBD
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.
¹ 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 SorhusSzymon Marczak
Sindre SorhusSzymon 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