simple-retry-fetch
v1.1.0
Published
A lightweight, dead simple TypeScript utility for making HTTP requests with automatic retries using exponential backoff.
Readme
Simple Retry Fetch
A lightweight, dead simple TypeScript utility for making HTTP requests with automatic retries using exponential backoff.
API
retryFetch(url, options?)
url(string): The URL to fetchoptions(RetryFetchOptions): Configuration object extending RequestInit with:retries(number): Maximum number of retry attempts (default: 3)retryDelay(function): Function to calculate delay between retries in milliseconds (default: exponential backoff)- ...all standard fetch options
Returns: Promise<Response>
Default retry delay uses exponential backoff: attempt => Math.pow(2, attempt) * 1000
Installation
npm install simple-retry-fetch