A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/webuniverseio/superagent-node-http-timings below:

webuniverseio/superagent-node-http-timings: Measure http timings in node.js

yarn add superagent-node-http-timings
npm i --save superagent-node-http-timings

This plugin for superagent gives you an easy interface to get http timings information. Primary use case is to be able to monitor and optimize network requests in node in a similar way to how you do it in browser with network inspector.

const request = require('superagent');
const logNetworkTime = require('superagent-node-http-timings');
request
  .get(`https://google.com`)
  .use(logNetworkTime((err, result) => {
    if (err) {
      return console.error(err);
    }
    console.log(result);
  }))
  .then(x => x);

Sample results (timings are in milliseconds)1:

{
  "status": 301,
  "timings": {
    "socketAssigned": 4.0982,
    "dnsLookup": 38.9614,
    "tcpConnection": 42.1931,
    "tlsHandshake": 105.221,
    "firstByte": 67.0892,
    "contentTransfer": 0.6482,
    "total": 258.2111
  },
  "url": "https://google.com"
}
Contributing to this repo

PRs are welcome! :)


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4