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

@tripathirajan/fetcher

v1.0.2

Published

A universal HTTP client for TypeScript and JavaScript with fetch and XHR fallback, supporting timeouts, retries, interceptors, and progress reporting.

Downloads

13

Readme

@tripathirajan/fetcher

npm License bundlephobia

A modern, universal HTTP client library for TypeScript and JavaScript that supports fetch and XHR fallback, timeouts, retries, interceptors, and progress reporting.

📊 Feature Support

| Feature | Browser | Node.js | | -------------------------- | :-----: | :-----: | | fetcher.get/post/... | ✅ | ✅ | | downloadWithProgress() | ✅ | ❌ | | postWithUploadProgress() | ✅ | ❌ |

✨ Quickstart

import fetcher from '@tripathirajan/fetcher';
const res = await fetcher.get('https://api.example.com/data');
const json = await res.json();

📦 Features

  • Automatic retries and timeouts
  • Request and response interceptors
  • Download and upload progress
  • Node.js and browser support
  • ESM, CJS, and IIFE builds

📥 Installation

npm install @tripathirajan/fetcher

🚀 Usage Examples

ESM (Node.js or Bundlers)

import fetcher from '@tripathirajan/fetcher';
// example usage here...

CommonJS

const fetcher = require('@tripathirajan/fetcher').default;
// example usage here...

IIFE (Browser)

<script src="https://unpkg.com/@tripathirajan/fetcher@<VERSION>/dist/fetcher.min.js"></script>
<script>
  fetcher
    .get('https://api.example.com/data')
    .then((res) => res.json())
    .then((data) => console.log(data));
</script>

⚙️ API Reference

fetcher.create(config)

Creates a new Fetcher instance.

Config Options

| Option | Type | Description | | ------------- | -------------------------------------- | ------------------------------------------- | | baseURL | string | Base URL for all requests | | headers | Record<string, string> | Default headers | | timeout | number | Timeout in milliseconds | | retries | number | Number of retry attempts | | credentials | "omit" \| "same-origin" \| "include" | Credential policy for cross-origin requests |

Methods

All methods return a native Response object. You must call .json(), .text(), etc. to parse.

  • get(url, config?)
  • post(url, body, config?)
  • put(url, body, config?)
  • delete(url, config?)
  • downloadWithProgress(url, onProgress, config?) (Browser only)
  • postWithUploadProgress(url, body, onUploadProgress, config?) (Browser only)

📚 Documentation

Full API documentation:

https://tripathirajan.github.io/fetcher/

🌐 Supported Environments

⚠️ downloadWithProgress and postWithUploadProgress are only available in browser environments and will throw an error if used in Node.js.

  • Node.js 16+
  • All modern browsers
  • Internet Explorer 11 (with polyfills for Fetch/XHR)

📂 Examples

See the examples folder for Node.js and Browser usage.

🛠️ Development

Run all pre-checks before build:

npm run prebuild

Note: The prebuild script runs automatically before npm run build. It ensures linting, formatting, and tests are successful before generating build output.

🤝 Contributing

Contributions, issues and feature requests are welcome! Feel free to open an issue or submit a pull request.

💖 Support

If you find this library useful, consider starring the repo or buying me a coffee.

🧩 License

MIT © 2025 Rajan Tripathi