got
Got is a human-friendly and powerful HTTP request library for Node.js that provides an extensive feature set beyond basic request/response handling. Got support…
Installation
npm install got
yarn add got
pnpm add got
Import
import got from 'got';
Quick Example
const data = await got('https://api.example.com/data').json();
console.log(data);
const response = await got.post('https://api.example.com/submit', {
json: { name: 'test' },
});About got
Got is a human-friendly and powerful HTTP request library for Node.js that provides an extensive feature set beyond basic request/response handling. Got supports automatic retries with customizable strategies, HTTP/2 support, progress events for uploads and downloads, Unix domain socket connections, pagination helpers for API endpoints, and RFC-compliant caching using a Keyv-compatible cache backend. The library handles redirects, cookies, timeouts (including separate connect, socket, and response timeouts), and response decompression automatically. Got's API supports both promise-based and stream-based patterns, making it suitable for both simple JSON API calls and complex streaming scenarios like downloading large files. The library includes built-in support for creating reusable instances with pre-configured defaults, hooks for request lifecycle events (beforeRequest, afterResponse, beforeRetry), and automatic request body serialization. Got is ESM-only since version 12, reflecting the Node.js ecosystem's shift toward ES modules. It is particularly well-suited for applications that need robust HTTP handling with retries, timeouts, and caching built in rather than implemented manually.
Quick Facts
| Package | got |
| Category | HTTP |
| Weekly Downloads | 10M+ |
| License | MIT |
| Install | npm install got |
Related Packages
Axios is a promise-based HTTP client for the browser and Node.js that provides an elegant and powerf…
Node-fetch is a lightweight module that brings the browser's Fetch API to Node.js, providing a famil…
Ky is a tiny and elegant HTTP client based on the browser Fetch API, providing a more convenient API…
Undici is a high-performance HTTP/1.1 client for Node.js, developed by the Node.js team and serving …
SuperAgent is a progressive HTTP request library for Node.js and the browser that provides a flexibl…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.