@achmadk/axios-time
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

npm

📦 @achmadk/axios-time

Axios plugin to measure the actual time it takes for a request to complete. It has TypeScript and a native ES Module support compared to axios-time.

🔧 Installation

You can install this plugin using NPM or any other package manager

> npm i @achmadk/axios-time

🚲 Basic Usage

The example below will add timing data to the request-response cycle.

import axios from 'axios';
import axiosTime from 'axios-time';

axiosTime(axios);

try {
    const response = await axios.get('/user');
} catch(err) {
}

response.timings object example:

{
  "timingEnd": 1599035291441,   // Timestamp of the start of the request (in Unix Epoch milliseconds).
  "timingStart": 1599035289182, // Timestamp when the response ended (in Unix Epoch milliseconds).
  "elapsedTime": 2259           // Duration of the entire request/response in milliseconds.
}

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i @achmadk/axios-time

Weekly Downloads

3

Version

1.0.1

License

MIT

Unpacked Size

21.3 kB

Total Files

13

Last publish

Collaborators

  • achmadkurnianto