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

@kouhin/redaxios

v1.2.1

Published

The Axios API, as a tiny (~4KB) Fetch wrapper. Rewritten in TypeScript with axios-compatible error handling.

Readme

@kouhin/redaxios

npm CI license

The Axios API, as a tiny Fetch wrapper. Rewritten in TypeScript with full type definitions and axios-compatible error handling.

This is a fork of developit/redaxios.

Why this fork?

The original redaxios by Jason Miller is an excellent project that provides the Axios API in a tiny package using the browser's native fetch(). However, the original project has not been actively maintained since version 0.5.1, and has several limitations:

  • No TypeScript source -- written in JavaScript with JSDoc type annotations, resulting in incomplete type definitions.
  • Error handling incompatible with Axios -- rejected promises returned the response object directly instead of an Error instance, making try/catch patterns and error inspection unreliable.
  • Outdated toolchain -- relied on legacy tools (microbundle, karmatic/Jasmine, ESLint + Prettier, npm) that are no longer well-maintained.

This fork addresses all of the above while keeping the original design philosophy: a minimal, drop-in replacement for Axios built on fetch().

Changes from upstream

  • Full TypeScript rewrite with exported types: Options, Response, RedaxiosError, RedaxiosInstance, etc.
  • Axios-compatible error handling -- errors are proper Error instances with message, status, code (ERR_BAD_REQUEST / ERR_BAD_RESPONSE / ERR_NETWORK / ERR_CANCELED / ECONNABORTED), response, config, and isAxiosError flag.
  • axios.isAxiosError() helper for type-safe error checking.
  • Request cancellation via AbortController / signal option, with axios.isCancel() helper.
  • Request timeout via timeout option (in milliseconds), using AbortSignal.timeout().
  • Removed deprecated/legacy features: CancelToken, axios.all(), axios.spread(), XSRF cookie handling.
  • Modern toolchain: Bun for package management, building, and testing; Biome for linting and formatting.
  • ESM + CJS dual output (UMD removed as obsolete).

Install

npm install @kouhin/redaxios
# or
bun add @kouhin/redaxios
# or
pnpm add @kouhin/redaxios

Usage

import axios from '@kouhin/redaxios';

// GET request
const res = await axios.get('/api/users');
console.log(res.data);

// POST request with JSON body
const res = await axios.post('/api/users', {
  name: 'Alice',
});

// Error handling (axios-compatible)
try {
  await axios.get('/api/not-found');
} catch (err) {
  if (axios.isAxiosError(err)) {
    console.error(err.message);        // "Request failed with status code 404"
    console.error(err.status);         // 404
    console.error(err.code);           // "ERR_BAD_REQUEST"
    console.error(err.response?.data); // response body
  }
}

// Request cancellation
const controller = new AbortController();
axios.get('/api/slow', { signal: controller.signal })
  .catch(err => {
    if (axios.isCancel(err)) {
      console.log('Request canceled');
    }
  });
controller.abort();

// Request timeout (in milliseconds)
try {
  await axios.get('/api/slow', { timeout: 5000 });
} catch (err) {
  if (axios.isAxiosError(err) && err.code === 'ECONNABORTED') {
    console.error('Request timed out');
  }
}

// Create an instance with defaults
const api = axios.create({
  baseURL: 'https://api.example.com',
  headers: { Authorization: 'Bearer token' },
  timeout: 10000,
});
await api.get('/me');

API

This library is designed as a drop-in replacement for Axios. Refer to the Axios Documentation for full API details.

Supported features

  • axios(url, config?) / axios(config)
  • axios.get(), .post(), .put(), .patch(), .delete(), .head(), .options()
  • axios.create(defaults)
  • axios.isAxiosError() / axios.isCancel()
  • Request cancellation via signal (AbortSignal)
  • Request timeout via timeout (milliseconds)
  • Request body transforms via transformRequest
  • baseURL, params, paramsSerializer, headers, auth, validateStatus
  • responseType (text, json, blob, arrayBuffer, stream, formData)
  • Custom fetch implementation via options.fetch

License

Apache-2.0 -- originally created by Jason Miller at Google.