1.0.4 • Published 6 months ago

agile-fetch v1.0.4

Weekly downloads
-
License
MIT
Repository
github
Last release
6 months ago

Agile Fetch šŸš€

A lightweight, powerful fetch wrapper with auto-retry, timeout, and better error handling.

Installation

npm install agile-fetch

Usage

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));

Features

āœ… Auto-retry failed requests
āœ… Timeout support
āœ… Lightweight & fast
āœ… Works in Node.js and browser

API

new AgileFetch(options)

Creates a new instance of AgileFetch.

OptionTypeDefaultDescription
retriesnumber3Number of retry attempts for failed requests
timeoutnumber5000Timeout in milliseconds
backoffFactornumber200Backoff factor in milliseconds between retries

fetchWithRetry(url, options)

Fetches a URL with retry and timeout support.

ParameterTypeDescription
urlstringThe URL to fetch
optionsobjectOptional fetch request options

Installation for Development

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

Running Tests

This package includes test cases to ensure functionality. Run tests with:

npm test

License

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! šŸš€

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago