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

@eric8810/catcher-http

v0.3.10

Published

Catcher HTTP client — resilient transport with retry, circuit breaker, priority scheduling

Readme

@eric8810/catcher-http

npm version License: MIT

Resilient HTTP client for Node.js — retry, circuit breaker, priority queue, interceptors, SSE streaming. Part of the catcher toolkit.

Built on axios (optional peer dep) + cockatiel (circuit breaker) + p-retry + p-queue.

💡 For maximum performance, consider @eric8810/catcher-napi-http — Rust native via napi-rs, with typed TypeScript wrappers and the same config schema. Recommended for production Node.js workloads.

Install

npm install @eric8810/catcher-http
# axios is an optional peer dependency
npm install axios

Quick Start

import { createHttpClient } from '@eric8810/catcher-http'

const client = createHttpClient({
  baseURL: 'https://api.example.com',
  keepAlive: true,
  retry: { attempts: 3, backoff: 'exponential', minTimeout: 500 },
  concurrency: 10,
  circuitBreaker: { failureThreshold: 5, resetTimeout: 30_000 },
})

// Basic requests
const user = await client.get('/users/1')
const created = await client.post('/messages', { text: 'hello' })

// Per-request overrides
await client.get('/analytics', { retry: false, timeout: 5000 })

// Dynamic interceptors
client.interceptors.request.use(config => {
  config.headers['Authorization'] = `Bearer ${token}`
  return config
})

SSE Streaming

One-shot stream (e.g. OpenAI)

import { createSSEStream } from '@eric8810/catcher-http'

const stream = createSSEStream({
  url: 'https://api.openai.com/v1/chat/completions',
  method: 'POST',
  headers: { Authorization: `Bearer ${apiKey}` },
  body: { model: 'gpt-4', messages: [{ role: 'user', content: 'Hello' }], stream: true },
})

for await (const line of stream) {
  if (!line.startsWith('data:')) continue
  const payload = line.startsWith('data: ') ? line.slice(6) : line.slice(5)
  if (payload === '[DONE]') break
  process.stdout.write(JSON.parse(payload).choices[0]?.delta?.content ?? '')
}

Long-lived push with auto-reconnect

import { createSSEClient } from '@eric8810/catcher-http'

const sse = createSSEClient({
  url: 'https://api.example.com/events',
  reconnect: { initialDelay: 1000, maxDelay: 30_000 },
})

for await (const line of sse) {
  if (line.startsWith('data: ')) console.log(line.slice(6))
}

API

createHttpClient(config)

Resilience layers (inside → out): axios → retry → circuit breaker → concurrency queue

interface HttpClientConfig {
  baseURL?: string
  timeout?: number
  keepAlive?: boolean
  retry?: RetryOptions | false
  concurrency?: number
  circuitBreaker?: { failureThreshold: number; resetTimeout: number }
  interceptors?: { request?: Function[]; response?: [Function?, Function?] }
  auth?: { username: string; password: string }
  bearerToken?: string | (() => Promise<string>)
  // ... more options
}

Client Methods

| Method | Priority | |--------|----------| | client.get(url, config?) | 3 (low) | | client.put(url, body?, config?) | 2 | | client.patch(url, body?, config?) | 2 | | client.post(url, body?, config?) | 1 (high) | | client.delete(url, config?) | 3 | | client.circuitBreakerState() | 'closed' \| 'open' \| 'half-open' | | client.queueDepth() | Current queue size | | client.on(event, listener) | Subscribe to events | | client.updateConfig(updates) | Hot-update retry/timeout at runtime |

Additional Exports

| Export | Description | |--------|-------------| | createRetryWrapper(fn, retryOpts) | Wrap any async function with retry | | createInterceptorManager() | Standalone interceptor chain | | createSharedAgent(opts) | TCP keep-alive + DNS cache agent | | clearDnsCache() | Clear the shared DNS cache | | createPriorityQueue(opts) | Priority-based concurrency queue | | createSSEStream(opts) | One-shot SSE async iterable | | createSSEClient(opts) | Long-lived SSE with auto-reconnect |

License

MIT