Gathering detailed insights and metrics for es-fresh
Gathering detailed insights and metrics for es-fresh
Gathering detailed insights and metrics for es-fresh
Gathering detailed insights and metrics for es-fresh
npm install es-fresh
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
2 Stars
21 Commits
1 Forks
1 Watching
1 Branches
2 Contributors
Updated on 11 Sept 2024
TypeScript (100%)
Cumulative downloads
Total Downloads
Last day
-5.9%
12,675
Compared to previous day
Last week
2.5%
67,221
Compared to previous week
Last month
6.2%
274,100
Compared to previous month
Last year
362.9%
2,766,992
Compared to previous year
3
This is a copy of @foxify/fresh package but with ESM and CommonJS targets.
HTTP response freshness testing.
1pnpm i es-fresh
1import fresh from 'es-fresh'
fresh(reqHeaders, resHeaders)
Check freshness of the response using request and response headers.
When the response is still "fresh" in the client's cache true
is
returned, otherwise false
is returned to indicate that the client
cache is now stale and the full response should be sent.
When a client sends the Cache-Control: no-cache
request header to
indicate an end-to-end reload request, this module will return false
to make handling these requests transparent.
1import fresh from 'es-fresh' 2import { createServer } from 'http' 3 4function isFresh(req, res) { 5 return fresh(req.headers, { 6 etag: res.getHeader('ETag'), 7 'last-modified': res.getHeader('Last-Modified'), 8 }) 9} 10 11createServer((req, res) => { 12 // perform server logic 13 // ... including adding ETag / Last-Modified response headers 14 15 if (isFresh(req, res)) { 16 // client has a fresh copy of resource 17 res.statusCode = 304 18 res.end() 19 return 20 } 21 22 // send the resource 23 res.statusCode = 200 24 res.end('hello, world!') 25}).listen(3000)
MIT © v1rtl
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
4 existing vulnerabilities detected
Details
Reason
Found 1/20 approved changesets -- score normalized to 0
Reason
1 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
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2024-11-18
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