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 🙏

© 2026 – Pkg Stats / Ryan Hefner

super-fetch-proxy

v1.0.2

Published

A fetch utility that falls back to proxy when direct fetch fails

Readme

super-fetch-proxy-proxy

A robust fetch utility that automatically falls back to proxy when direct fetch fails. This package is particularly useful when you need a reliable way to make HTTP requests with automatic proxy fallback.


Features

  • 🚀 Attempts direct fetch first for optimal performance
  • 🔄 Automatic fallback to proxy on failure
  • 🎲 Random proxy selection from provided pool
  • 📦 TypeScript support
  • ⚡ Promise-based API
  • 🛡️ Error handling with detailed messages

Installation

npm install super-fetch-proxy

Usage

Basic Example (TypeScript)

import FetchWithProxyFallback from 'super-fetch-proxy';

// Your function to fetch proxies (should return a Promise<string[]>)
async function getProxies() {
  // Example: fetch from your proxy provider or use a static list
  return [
    'http://proxy1.example.com:8080',
    'http://proxy2.example.com:8080'
  ];
}

const fetcher = new FetchWithProxyFallback(getProxies);

fetcher.fetch('https://api.example.com/data')
  .then(response => response.json())
  .then(data => console.log(data))
  .catch(err => console.error('Fetch failed:', err));

Advanced Usage with Custom Options

const fetchOptions = {
  method: 'GET',
  headers: {
    'Accept': 'application/json'
  }
};

fetcher.fetch('https://api.example.com/data', fetchOptions)
  .then(response => response.json())
  .then(data => console.log(data));

Integration Example

This package is designed to be easily integrated into larger projects. For example, here’s how it can be used in a demo function:

import FetchWithProxyFallback from 'super-fetch-proxy';
import getRandomProxy from 'getactiveproxies';

const fetchInstance = new FetchWithProxyFallback(getRandomProxy);
const FetchUtil = fetchInstance.fetch.bind(fetchInstance);

// Use FetchUtil in your API calls

Or in a class-based architecture:

import searchMovie from "./helper/search.js";
import FetchWithProxyFallback from "super-fetch-proxy";
import getRandomProxy from "getactiveproxies";

class FetchMovieData {
  constructor(time) {
    this.fetchInstance = new FetchWithProxyFallback(getRandomProxy, time);
    this.FetchUtil = this.fetchInstance.fetch.bind(this.fetchInstance);
  }

  async searchMovie(query, country = "IN") {
    return await searchMovie(query, this.FetchUtil, country);
  }
}

API

FetchWithProxyFallback

Constructor

new FetchWithProxyFallback(
  proxyFetcher: (...args: any[]) => Promise<string[]>,
  ...args: any[]
)
  • proxyFetcher: A function that returns a Promise resolving to an array of proxy URLs.
  • ...args: Optional arguments passed to the proxyFetcher.

fetch(url: string, options?: RequestInit): Promise<Response>

Attempts to fetch the URL directly. If it fails, retries using a randomly selected proxy.


License

MIT