Package Exports
- @szmarczak/http-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 (@szmarczak/http-timer) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
http-timer
Timings for HTTP requests
Inspired by the request package.
Usage
'use strict';
const https = require('https');
const timer = require('@szmarczak/http-timer');
const request = https.get('https://httpbin.org/anything');
const timings = timer(request);
request.on('response', response => {
response.on('data', () => {}); // Consume the data somehow
response.on('end', () => {
console.log(timings);
});
});
// { start: 1535137471536,
// socket: 1535137471537,
// lookup: 1535137471537,
// connect: 1535137471582,
// response: 1535137472284,
// end: 1535137472285,
// phases:
// { wait: 1,
// dns: 0,
// firstByte: 702,
// download: 1,
// total: 749,
// tcp: 45 } }License
MIT