A fetch wrapper that adds enterprise features like retry policy (exponential backoff), request timeout via AbortController, and request proxy. v2.0.2 is current, supports both browser and Node.js, ships ESM and CJS bundles, and includes TypeScript definitions. Differentiated from plain fetch by built-in configurable retry with minTimeout, factor, and maxTimeout, plus a doRetry callback for custom logic.
npm install enterprise-fetchNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows default import with timeout and custom retry policy using async/await.
Always provide timeout in milliseconds, use 0 or undefined to disable.
Provide full retry config or omit to use defaults.
Update doRetry to new signature: (attempt, res, { url, options }) => booleanDo not depend on 'abort' event; handle timeout via catch block checking 'name' property.
Use a fetch polyfill for older browsers or import 'node-fetch' for Node < 18.
Install 'node-fetch' and add 'import fetch from 'node-fetch'; global.fetch = fetch;' or upgrade Node to >=18.
Ensure 'enterprise-fetch' is installed and use 'import enterpriseFetch from 'enterprise-fetch'; for default import.
Update doRetry to match new signature: (attempt, res, { url, options }) => booleanIncrease timeout or ensure server responds within timeout window.