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

fetchloom

v1.0.3

Published

A smarter HTTP client built on top of Axios with retries, caching, key transformation, and clean errors.

Readme

fetchloom

A small Axios-based HTTP client with automatic retries, in-memory GET caching, recursive snake_case to camelCase response transformation, and consistent errors.

Install

npm install fetchloom

Node.js 16+ and modern browser bundlers such as Vite and Webpack are supported.

Quick start

CommonJS:

const fetchloom = require("fetchloom");

const response = await fetchloom.get("https://api.example.com/users");
console.log(response.data);

ES modules:

import fetchloom from "fetchloom";

const api = fetchloom.create({
  baseURL: "https://api.example.com",
  headers: { Accept: "application/json" },
});

const { data } = await api.get("/users");

fetchloom returns Axios-compatible response objects. Automatic transformation is applied to response.data.

Requests

await api.get("/users", { retry: 2, cache: 30 });
await api.post("/users", { first_name: "Ada" });
await api.put("/users/1", { first_name: "Grace" });
await api.delete("/users/1");

The final argument accepts normal Axios request options plus:

| Option | Type | Default | Description | | ----------- | ----------------- | ------- | ----------------------------------------- | | retry | number | 3 | Retries after the initial request | | cache | number or false | 60 | GET cache TTL in seconds; 0 disables | | transform | boolean | true | Convert response object keys to camelCase |

Instance configuration also supports baseURL, headers, timeout, Axios adapters, and other Axios configuration. The default timeout is 5000ms.

const api = fetchloom.create({
  baseURL: "https://api.example.com",
  retry: 3,
  cache: 60,
  transform: true,
  timeout: 5000,
});

Retry behavior

Network failures and HTTP 5xx responses are retried. HTTP 4xx responses and canceled requests are not retried. The default waits are 1 second, 2 seconds, and 3 seconds before the three retries.

Caching

Only successful GET responses are cached. POST, PUT, and DELETE requests are never cached. Authenticated requests containing headers such as Authorization, Cookie, or X-API-Key bypass the cache.

await api.get("/users", { cache: false });
api.clearCache();

The cache is local to each fetchloom instance and is cleared when the process or browser page exits.

Transformation

Nested objects and arrays are transformed without changing the original response data:

// API data: { user_profile: { first_name: 'Ada' } }
const { data } = await api.get("/profile");
// data: { userProfile: { firstName: 'Ada' } }

Use { transform: false } for endpoints where keys must be preserved. Empty response bodies are normalized to null; primitive values are returned unchanged.

Errors

All request failures are thrown as one of:

  • NetworkError for connection and timeout failures
  • ServerError for HTTP 5xx responses
  • ClientError for HTTP 4xx responses
try {
  await api.get("/private");
} catch (error) {
  console.error(error.type);
  console.error(error.message);
  console.error(error.status);
  console.error(error.url);
  console.error(error.originalError);
}

Sensitive authentication headers are removed from originalError.

Development

npm install
npm test
npm run coverage
npm run lint
npm run format:check

License

MIT