JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 26
  • Score
    100M100P100Q45619F
  • License MIT

Node.js module for timing HTTP/S requests

Package Exports

  • https-timer

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (https-timer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

https-timer

A Node.js module for timing HTTP/HTTPS requests.

Useful for determining the timing of the following events:

  • Socket Initialization
  • DNS Lookup
  • TCP Connection
  • TLS Handshake
  • Request
  • Time to First Byte
  • Content transfer

Installation

$ npm install https-timer --save

Basic Usage

const httpsTimer = require('https-timer');

httpsTimer.get('https://www.google.com', (error, response) => {
  if (!error && response) {
    console.log(response.timing); // Prints the timing durations below
  }
});

When a request has ended, a timing object is added to the response object.

Here is an example snapshot of the timing object. The timing durations are in milliseconds:

{
  "durations": {
    "socketOpen": 1.591956,
    "dnsLookup": 20.326722,
    "tcpConnection": 45.247362,
    "tlsHandshake": 93.815933,
    "sendRequest": 1.593583,
    "firstByte": 154.307801,
    "contentTransfer": 2.472127,
    "total": 319.355484
  }
}

License

MIT License

Copyright (c) 2016-2018 Josh Crozier