Composable utilities for the standard Fetch API, version 3.2.0. Provides lightweight, tree-shakeable middleware-style wrappers (withTimeout, withBaseUrl, withHeaders, withRetry, etc.) that decorate the native fetch function. No wrapper objects, no new interface—just pure function composition. Works in browsers, Node.js (>=22), Deno, Bun, Cloudflare Workers. Zero dependencies, full TypeScript generics, Standard Schema response validation. Designed for building minimal, focused HTTP clients without lock-in.
npm install fetch-extrasNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a reusable API client with timeout, base URL, auth headers, HTTP error throwing, and JSON parsing.
Ensure your project is ESM (type: module) and Node.js >=22. Use v2.x if CommonJS support is needed.
Always use pipeline() in the documented order; do not manually compose wrappers unless you understand the nesting.
If you need conditional caching, handle manually or use a different caching layer.
For backpressure, combine with withConcurrency() or implement retry logic.
Upgrade to v3.0.0+ (requires ESM and Node.js >=22).
Add "type": "module" to your package.json, rename file to .mjs, or use Node.js >=22.
Use dynamic import: const { pipeline } = await import('fetch-extras'); or switch to ESM.Ensure your runtime supports fetch, or provide a polyfill. fetch is built into Deno, Bun, Cloudflare Workers, and Node >=18.
Place withHttpError() last (or near last) in the pipeline, after any response transformation wrappers.
No dependency data recorded yet.