Registry / testing / axios-timing

axios-timing

JSON →
library1.0.2jsnpmunverified

An Axios plugin that measures the actual time taken for HTTP requests to complete. Version 1.0.2 is the latest stable release. It is a lightweight utility for performance monitoring, using interceptors to track request duration and reporting via a callback. Differentiators include simple integration with either the global axios instance or a custom instance, and support for custom callback functions.

npm install axios-timing
INSTALL
IMPORT
SIG · AXIOS-TIMING
A
axios-timing
testingjavascriptv1.0.2
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import axiosTiming from 'axios-timing'
const axiosTiming = require('axios-timing')
Package is ESM-only; CommonJS require will not work (no default export).
default
import axiosTiming from 'axios-timing'
import { axiosTiming } from 'axios-timing'
The package exports a single default function, not a named export.
none (function call)
axiosTiming(axios, callback)
axiosTiming(axios).then(callback)
axiosTiming does not return a promise; it modifies axios in-place. The callback is called synchronously.

Shows how to import axios-timing, attach it to the global axios instance, and measure request times logged via console.log.

import axios from 'axios'; import axiosTiming from 'axios-timing'; // Enable timing with default console.log axiosTiming(axios, console.log); // Make a request axios.get('https://api.example.com/data') .then(response => { console.log('Data:', response.data); }) .catch(error => { console.error('Error:', error); });
Debug
Known issues
breakingaxios-timing is ESM-only. Using require() will throw an error: 'ERR_REQUIRE_ESM'.
fix
Use import syntax or convert your project to ESM (e.g., set type: 'module' in package.json).
affects: >=1.0
gotchaThe callback is called synchronously after each request completes (in the response interceptor). It does not return a promise.
fix
Do not await axiosTiming(); just call it and let the callback handle timing data.
affects: >=1.0
gotchaPassing a custom callback that expects (timeInMs) but the package also passes the entire response object as second argument if callback accepts more than one parameter.
fix
Define your callback with exact parameters you need, e.g., (timeInMs) => ... or (timeInMs, response) => ...
affects: >=1.0
deprecatedaxios-timing has not been updated in over 3 years. It works with axios v0.x and v1.x but may conflict with future axios versions.
fix
Consider alternatives like axios' built-in 'onDownloadProgress' or other actively maintained timers.
affects: >=1.0
Errors
Common errors & fixes
TypeError: axiosTiming is not a function
Using a named import ({ axiosTiming }) instead of default import.
fix
Use: import axiosTiming from 'axios-timing' (without curly braces).
ERR_REQUIRE_ESM
Trying to require() an ESM-only package.
fix
Use import syntax instead of require(), or set type: 'module' in package.json if using Node.
Cannot find module 'axios-timing'
Package not installed or import path incorrect.
fix
Run 'npm install axios-timing' and ensure the import path is correct: 'axios-timing' (not './axios-timing').
Upgrade
Version history
1.0.2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
axios-timing — npm install axios-timing · libregistry