Path: blob/master/node_modules/@szmarczak/http-timer/README.md
1126 views
http-timer
Timings for HTTP requests
Inspired by the request
package.
Installation
NPM:
npm install @szmarczak/http-timer
Yarn:
yarn add @szmarczak/http-timer
Usage
Note:
The measured events resemble Node.js events, not the kernel ones.
Sending a chunk greater than
highWaterMark
will result in invalidupload
andresponse
timings. You can avoid this by splitting the payload into smaller chunks.
API
timer(request)
Returns: Object
Note: The time is a number
representing the milliseconds elapsed since the UNIX epoch.
start
- Time when the request started.socket
- Time when a socket was assigned to the request.lookup
- Time when the DNS lookup finished.connect
- Time when the socket successfully connected.secureConnect
- Time when the socket securely connected.upload
- Time when the request finished uploading.response
- Time when the request firedresponse
event.end
- Time when the response firedend
event.error
- Time when the request firederror
event.abort
- Time when the request firedabort
event.phases
wait
-timings.socket - timings.start
dns
-timings.lookup - timings.socket
tcp
-timings.connect - timings.lookup
tls
-timings.secureConnect - timings.connect
request
-timings.upload - (timings.secureConnect || timings.connect)
firstByte
-timings.response - timings.upload
download
-timings.end - timings.response
total
-(timings.end || timings.error || timings.abort) - timings.start
If something has not been measured yet, it will be undefined
.
License
MIT