undici
Undici is a high-performance HTTP/1.1 client for Node.js, developed by the Node.js team and serving as the foundation for Node.js's built-in global fetch since …
Installation
npm install undici
yarn add undici
pnpm add undici
Import
import { request } from 'undici';Quick Example
import { request } from 'undici';
const { statusCode, body } = await request('https://api.example.com/data');
const data = await body.json();
console.log(statusCode, data);About undici
Undici is a high-performance HTTP/1.1 client for Node.js, developed by the Node.js team and serving as the foundation for Node.js's built-in global fetch since version 18. The name means 'eleven' in Italian, referencing HTTP/1.1. Undici is written from scratch without using Node.js's built-in http module, instead managing TCP connections directly for maximum performance and connection pooling efficiency. It provides a Fetch-compatible API, a low-level request API for fine-grained control, and connection pool management with configurable pipelining that can significantly improve throughput for multiple sequential requests to the same origin. Undici handles HTTP keep-alive connections automatically, supports proxy connections through ProxyAgent, and provides interceptors for request/response modification. The library includes MockAgent for intercepting and mocking HTTP requests in tests without actually making network calls. Undici consistently benchmarks as the fastest HTTP client available for Node.js. It is the recommended HTTP client for Node.js applications that need maximum performance and is now the standard HTTP implementation used by Node.js's built-in fetch function.
Quick Facts
| Package | undici |
| Category | HTTP |
| Weekly Downloads | 15M+ |
| License | MIT |
| Install | npm install undici |
Related Packages
Node-fetch is a lightweight module that brings the browser's Fetch API to Node.js, providing a famil…
Got is a human-friendly and powerful HTTP request library for Node.js that provides an extensive fea…
Axios is a promise-based HTTP client for the browser and Node.js that provides an elegant and powerf…
Ky is a tiny and elegant HTTP client based on the browser Fetch API, providing a more convenient API…
Browse npm Packages by Category
Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.