Gathering detailed insights and metrics for @szmarczak/http-timer
Gathering detailed insights and metrics for @szmarczak/http-timer
Gathering detailed insights and metrics for @szmarczak/http-timer
Gathering detailed insights and metrics for @szmarczak/http-timer
npm install @szmarczak/http-timer
Typescript
Module System
Min. Node Version
Node Version
NPM Version
TypeScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
191 Stars
49 Commits
17 Forks
3 Watchers
1 Branches
4 Contributors
Updated on Mar 27, 2025
Latest Version
5.0.1
Package Id
@szmarczak/http-timer@5.0.1
Size
3.58 kB
NPM Version
7.20.3
Node Version
16.6.2
Published on
Aug 20, 2021
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Timings for HTTP requests
Inspired by the request
package.
NPM:
npm install @szmarczak/http-timer
Yarn:
yarn add @szmarczak/http-timer
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.
1import https from 'https'; 2import timer from '@szmarczak/http-timer'; 3 4const request = https.get('https://httpbin.org/anything'); 5timer(request); 6 7request.once('response', response => { 8 response.resume(); 9 response.once('end', () => { 10 console.log(response.timings); // You can use `request.timings` as well 11 }); 12}); 13 14// { 15// start: 1572712180361, 16// socket: 1572712180362, 17// lookup: 1572712180415, 18// connect: 1572712180571, 19// upload: 1572712180884, 20// response: 1572712181037, 21// end: 1572712181039, 22// error: undefined, 23// abort: undefined, 24// phases: { 25// wait: 1, 26// dns: 53, 27// tcp: 156, 28// request: 313, 29// firstByte: 153, 30// download: 2, 31// total: 678 32// } 33// }
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 fired response
event.end
- Time when the response fired end
event.error
- Time when the request fired error
event.abort
- Time when the request fired abort
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
.
MIT
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More