/ archiveofbelonging.org / back / node_modules / @szmarczak / http-timer /

[ICO]NameLast modifiedSizeDescription
[PARENTDIR]Parent Directory  -  
[DIR]source/2 years ago -  
[   ]LICENSE40 years ago1.0K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
[TXT]README.md40 years ago2.2Kf12eb36 documentaiton updates [كارل مبارك]
[   ]package.json2 years ago1.8K7375cab EXHIBTION: fix overflow ellipsis cutoff [كارل مبارك]
README.md

http-timer

Timings for HTTP requests

Build Status Coverage Status install size

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: 1535708511443,
//   socket: 1535708511444,
//   lookup: 1535708511444,
//   connect: 1535708511582,
//   upload: 1535708511887,
//   response: 1535708512037,
//   end: 1535708512040,
//   phases:
//    { wait: 1,
//      dns: 0,
//      tcp: 138,
//      request: 305,
//      firstByte: 150,
//      download: 3,
//      total: 597 } }

API

timer(request)

Returns: Object

Note: The time is a number representing the milliseconds elapsed since the UNIX epoch.

License

MIT

Apache/2.4.38 (Debian) Server at www.karls.computer Port 80