🌐
HTTP15M+/wkMIT

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
npm install undici
yarn
yarn add undici
pnpm
pnpm add undici

Import

ESM
import { request } from 'undici';

Quick Example

usage
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

Packageundici
CategoryHTTP
Weekly Downloads15M+
LicenseMIT
Installnpm install undici

Related Packages

Browse npm Packages by Category

Explore our reference of 200 popular npm packages with install commands, examples, and quick-start guides.