Hardened Fetch is a lightweight wrapper around global.fetch for Node.js (v20+) that adds request timeouts, throttling, rate limit awareness, retries with exponential backoff, and descriptive error messages. It is designed for building robust API clients and web scrapers without external SDKs. Version 2.0.0 is actively maintained, ships with TypeScript definitions, and focuses on configurability—allowing control over concurrency, rate limits, retry policies, and abort signals. Key differentiators: small footprint, no dependencies, and built-in rate limit header parsing.
npm install hardened-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a HardenedFetch client with custom retry and throttle options, fetches a resource, and handles errors.
Migrate to ESM syntax (import/export) and update Node.js to 20+.
Replace 'new Fetch(...)' with 'new HardenedFetch(...)'.
Use 'doNotRetryMethods' to list methods that should NOT be retried.
Ensure your API returns headers matching the 'rateLimitHeaders' list, or disable rate-limit-based retries by setting an empty array.
Pass timeout as third argument to client.fetch(), not in the init object.
Use import statements or dynamic import() instead of require().
Use import { HardenedFetch } from 'hardened-fetch'Check network connectivity, increase maxRetries, or add error handling.
Increase the timeout value passed to client.fetch() or improve network latency.
No dependency data recorded yet.