Installations
npm install express-static-gzip-nesto
Developer Guide
Typescript
No
Module System
CommonJS
Node Version
8.5.0
NPM Version
5.3.0
Score
64.8
Supply Chain
87.1
Quality
73.6
Maintenance
100
Vulnerability
100
License
Releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (99.86%)
HTML (0.07%)
Scilab (0.04%)
CSS (0.03%)
Developer
tkoenig89
Download Statistics
Total Downloads
635
Last Day
1
Last Week
2
Last Month
5
Last Year
48
GitHub Statistics
147 Stars
150 Commits
28 Forks
2 Watching
3 Branches
17 Contributors
Package Meta Information
Latest Version
0.3.1
Package Id
express-static-gzip-nesto@0.3.1
Size
4.23 kB
NPM Version
5.3.0
Node Version
8.5.0
Total Downloads
Cumulative downloads
Total Downloads
635
Last day
0%
1
Compared to previous day
Last week
0%
2
Compared to previous week
Last month
400%
5
Compared to previous month
Last year
-44.2%
48
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dependencies
1
express-static-gzip
Provides a small layer on top of the express.static middleware, which allows to serve pre-gzipped files from a directory. Now supports other compressions like brotli as well.
Requirements
For the express-static-gzip middleware to work properly you need to first ensure that you have all files gzipped, which you want to serve as a compressed version to the browser. Simplest use case is to either have a folder with only .gz files, or you have a folder with the .gz files next to the original files. Some goes for other compressions.
Usage
In case you just want to serve gzipped files only, this simple example would do:
1var express = require("express"); 2var expressStaticGzip = require("express-static-gzip"); 3var app = express(); 4 5app.use("/", expressStaticGzip("/my/rootFolder/"));
While gzip compression is always enabled you now have the choice to add other types of compressions using the options object. Currently brotli can be enabled using the options.enableBrotli flag. All other compressions need to be added by passing an array to options.customCompressions. The options object is also passed to the express.static middleware, in case you want to configure this one as well.
The following example will show howto add brotli and deflate(with file extension .zz) to the middleware (it will still support gzip):
1var express = require("express"); 2var expressStaticGzip = require("express-static-gzip"); 3var app = express(); 4 5app.use("/", expressStaticGzip("/my/rootFolder/", { 6 enableBrotli: true, 7 customCompressions: [{ 8 encodingName: "deflate", 9 fileExtension: "zz" 10 }] 11}));
Compressions are selected in the following order if a file is requested from the middleware:
- any custom compression in the order they are provided to options.customCompressions
- brotli (if enabled via options.enableBrotli)
- gzip
- plain file (in case no compression exists or none is matching the browsers accepted encodings header)
When the middleware is created it will check the given root folder and all subfolders for files matching the registered compression. Adding files later to the folder will not be recognized by the middleware.
In default mode a request for "/" or "<somepath>/" will now serve index.html as compressed version. If for some kind of reason you don't want this to happen set options.indexFromEmptyFile to false.
1app.use("/", expressStaticGzip("/my/rootFolder/", { indexFromEmptyFile: false }));
Example
In case you have the following basic file structure
- rootFolder
- index.html
- index.html.gz
- index.html.br
- test.html.gz
- main.js
and you use set the enableBrotli flag to true, express-static-gzip will answer GET requests like this:
GET / >>> /my/rootFolder/index.html.br
GET /index.html >>> /my/rootFolder/index.html.br
GET /test.html >>> /my/rootFolder/test.html.gz
GET /main.js >>> /my/rootFolder/main.js
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
- Info: project has a license file: LICENSE.md:0
- Info: FSF or OSI recognized license: MIT License: LICENSE.md:0
Reason
5 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 5
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:21: update your workflow using https://app.stepsecurity.io/secureworkflow/tkoenig89/express-static-gzip/nodejs.yml/master?enable=pin
- Warn: GitHub-owned GitHubAction not pinned by hash: .github/workflows/nodejs.yml:23: update your workflow using https://app.stepsecurity.io/secureworkflow/tkoenig89/express-static-gzip/nodejs.yml/master?enable=pin
- Info: 0 out of 2 GitHub-owned GitHubAction dependencies pinned
- Info: 1 out of 1 npmCommand dependencies pinned
Reason
Found 2/16 approved changesets -- score normalized to 1
Reason
detected GitHub workflow tokens with excessive permissions
Details
- Warn: no topLevel permission defined: .github/workflows/nodejs.yml:1
- Info: no jobLevel write permissions found
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
SAST tool is not run on all commits -- score normalized to 0
Details
- Warn: 0 commits out of 18 are checked with a SAST tool
Reason
10 existing vulnerabilities detected
Details
- Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275
- Warn: Project is vulnerable to: GHSA-4q6p-r6v2-jvc5
- Warn: Project is vulnerable to: GHSA-896r-f27r-55mw
- Warn: Project is vulnerable to: GHSA-9c47-m6qq-7p4h
- Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3
- Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m / GHSA-xvch-5gv4-984h
- Warn: Project is vulnerable to: GHSA-rhx6-c78j-4q9w
- Warn: Project is vulnerable to: GHSA-p8p7-x288-28g6
- Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw
- Warn: Project is vulnerable to: GHSA-72xf-g2v4-qvf3
Score
3.6
/10
Last Scanned on 2024-12-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