Installations
npm install @masx200/koa-stream-etag
Developer Guide
Typescript
Yes
Module System
CommonJS
Node Version
16.15.1
NPM Version
8.5.1
Score
68.9
Supply Chain
99.3
Quality
75.6
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (81.66%)
TypeScript (18.34%)
Love this project? Help keep it running — sponsor us today! 🚀
Developer
masx200
Download Statistics
Total Downloads
4,667
Last Day
3
Last Week
12
Last Month
56
Last Year
1,187
GitHub Statistics
2 Stars
153 Commits
1 Forks
1 Watching
7 Branches
14 Contributors
Bundle Size
2.13 kB
Minified
1.03 kB
Minified + Gzipped
Package Meta Information
Latest Version
5.0.8
Package Id
@masx200/koa-stream-etag@5.0.8
Unpacked Size
10.44 kB
Size
4.00 kB
File Count
5
NPM Version
8.5.1
Node Version
16.15.1
Total Downloads
Cumulative downloads
Total Downloads
4,667
Last day
50%
3
Compared to previous day
Last week
-25%
12
Compared to previous week
Last month
-31.7%
56
Compared to previous month
Last year
37.9%
1,187
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
@masx200/koa-stream-etag
forked from https://github.com/koajs/etag
If the response of the koa server is a stream without a path, the response header of etag can also be generated,The etag response header is generated by converting stream to buffer for etag calculation.
stream Etag support for Koa responses using etag.
Installation
npm
1 2$ npm install @masx200/koa-stream-etag
yarn
$ yarn add @masx200/koa-stream-etag
API
1var etag = require("@masx200/koa-stream-etag");
etag([options])
Its return value is a koa middleware.
Generate a strong ETag for the given entity. This should be the complete body of the entity. Strings, Buffers, and fs.Stats are accepted. By default, a strong ETag is generated except for fs.Stats, which will generate a weak ETag (this can be overwritten by options.weak).
1var options = { weak: false, sizelimit: 1000 * 1024 }; 2app.use(etag(options));
Options
etag accepts these properties in the options object.
weak
Specifies if the generated ETag will include the weak validator mark (that is, the leading W/). The actual entity tag is the same. The default value is false, unless the entity is fs.Stats, in which case it is true.
sizelimit
Its unit is byte.If the size of the stream is smaller than the'sizelimit', the etag response header will be generated,by converting stream to buffer for etag calculation.
Example
1const conditional = require("koa-conditional-get"); 2const etag = require("@masx200/koa-stream-etag"); 3const Koa = require("koa"); 4const app = new Koa(); 5 6// etag works together with conditional-get 7app.use(conditional()); 8app.use(etag({})); 9 10app.use(function (ctx) { 11 ctx.body = "Hello World"; 12}); 13 14app.listen(3000, () => { 15 console.log("listening on port 3000"); 16});
License
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE:0
- Info: FSF or OSI recognized license: MIT License: LICENSE:0
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/node.js.yml:1
- Info: no jobLevel write permissions found
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 1/24 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/masx200/koa-stream-etag/node.js.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/node.js.yml:25: update your workflow using https://app.stepsecurity.io/secureworkflow/masx200/koa-stream-etag/node.js.yml/master?enable=pin
- Warn: npmCommand not pinned by hash: .github/workflows/node.js.yml:29
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 0 out of 1 npmCommand dependencies pinned
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 7 are checked with a SAST tool
Score
3.4
/10
Last Scanned on 2025-01-27
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