A lightweight, powerful fetch wrapper with auto-retry, timeout, and better error handling.
npm install agile-fetch
import AgileFetch from 'agile-fetch';
const fetcher = new AgileFetch({ retries: 3, timeout: 5000 });
fetcher.fetchWithRetry('https://jsonplaceholder.typicode.com/posts/1')
.then(data => console.log(data))
.catch(err => console.error(err));
✅ Auto-retry failed requests
✅ Timeout support
✅ Lightweight & fast
✅ Works in Node.js and browser
Creates a new instance of AgileFetch.
Option | Type | Default | Description |
---|---|---|---|
retries | number | 3 | Number of retry attempts for failed requests |
timeout | number | 5000 | Timeout in milliseconds |
backoffFactor | number | 200 | Backoff factor in milliseconds between retries |
Fetches a URL with retry and timeout support.
Parameter | Type | Description |
---|---|---|
url | string | The URL to fetch |
options | object | Optional fetch request options |
If you want to contribute or modify the package, clone the repository:
git clone https://github.com/rizkyngrh23/agile-fetch.git
cd agile-fetch
npm install
This package includes test cases to ensure functionality. Run tests with:
npm test
This project is licensed under the MIT License - see the LICENSE file for details.
This version includes:
✅ Detailed API documentation
✅ Installation & usage examples
✅ Testing instructions
✅ Contributing section
You can copy this into your README.md file on GitHub. Let me know if you need more changes! 🚀