npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

@nursoltan-s/fetchmate

v1.1.0

Published

Flexible Fetch API companion — extendable, reliable, and built for modern web requests.

Downloads

11

Readme

fetchmate

Your flexible Fetch API companion — extendable, reliable, and built for modern web requests..

npm version License: MIT Build Status Made with TypeScript


🚀 What is fetchmate?

@nursoltan-s/fetchmate is a lightweight and flexible wrapper around the native Fetch API that supercharges your HTTP requests with robust retry capabilities, customizable delays, and easy configuration.

Whether you're dealing with flaky network conditions, rate limits, or intermittent server errors, @nursoltan-s/fetchmate has got your back — so you can keep your code clean and your apps resilient.


✨ Key Features

  • Max retries: Automatically retry failed requests up to a configurable limit.
  • Retry delay: Control how long to wait between retries (in milliseconds).
  • Custom retry statuses: Retry not just on server errors but on any HTTP status codes you choose (like 429 Too Many Requests).
  • Simple API: Drop-in replacement for fetch, no hassle.
  • TypeScript support: Comes with type definitions out of the box.

📦 Installation

npm install @nursoltan-s/fetchmate
# or
yarn add @nursoltan-s/fetchmate

💡 Usage

import { fetchmate } from '@nursoltan-s/fetchmate';

async function getData() {
  try {
    const response = await fetchmate('https://api.example.com/data', {
      maxRetries: 3,
      retryDelay: 1000, // 1 second delay between retries
      retryOnStatuses: [429, 503], // Retry on "Too Many Requests" and "Service Unavailable"
      method: 'GET',
      headers: { 'Authorization': 'Bearer YOUR_TOKEN' }
    });

    if (!response.ok) {
      throw new Error(`HTTP error! status: ${response.status}`);
    }

    const data = await response.json();
    console.log(data);

  } catch (error) {
    console.error('Request failed:', error);
  }
}

⚙️ API

fetchmate(url: string, options?: FetchmateOptions): Promise

  • url: The resource you want to fetch.
  • options: An object extending the standard Fetch API options with additional properties:

| Option | Type | Default | Description | | ----------------- | ------------- | ----------- | ----------------------------------------------------------------------------------------- | | maxRetries | number | 0 | Maximum number of retry attempts. | | retryDelay | number | 300 (ms) | Base delay between retries. | | backoff | boolean | false | If true, applies exponential backoff (retryDelay * 2 ** attempt). | | retryOnStatuses | number[] | [500–599] | HTTP status codes that should trigger a retry. | | ... | RequestInit | — | All standard Fetch API options. |

🔧 Why fetchmate?

  • ✅ Resilient networking — Prevent temporary network blips or server hiccups from crashing your app.

  • ⚙️ Customizable — You decide what’s retryable and how aggressively to retry.

  • 🪶 Lightweight — No heavy dependencies, just a few lines of clean, tested code.

  • 🔒 TypeScript-friendly — Write safer code with full type support.

🧪 Testing

fetchmate is thoroughly tested with Jest and supports both JavaScript and TypeScript environments.

npm test

🤝 Contributing

Contributions, issues, and feature requests are welcome! Feel free to check the issues or submit a pull request.

📜 License

MIT License © 2025 [Nursoltan Saipolda]


Made with ❤️ by fetchmate — your fetch’s best mate in the wild web.