Socket
Socket
Sign inDemoInstall

@achmadk/axios-time

Package Overview
Dependencies
10
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @achmadk/axios-time

![npm](https://img.shields.io/npm/v/axios-time)


Version published
Weekly downloads
4
increased by100%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

npm

:package: @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.

:wrench: Installation

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

> npm i @achmadk/axios-time

:bike: 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

FAQs

Last updated on 20 Mar 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc