Gathering detailed insights and metrics for express-static-gzip-nesto
Gathering detailed insights and metrics for express-static-gzip-nesto
Gathering detailed insights and metrics for express-static-gzip-nesto
Gathering detailed insights and metrics for express-static-gzip-nesto
Simple wrapper on top of serveStatic, that allows serving pre-gzipped files as well as other types of compressions.
npm install express-static-gzip-nesto
Typescript
Module System
Node Version
NPM Version
JavaScript (99.86%)
HTML (0.07%)
Scilab (0.04%)
CSS (0.03%)
Total Downloads
684
Last Day
1
Last Week
7
Last Month
14
Last Year
81
MIT License
149 Stars
154 Commits
29 Forks
1 Watchers
3 Branches
18 Contributors
Updated on May 06, 2025
Minified
Minified + Gzipped
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
Cumulative downloads
Total Downloads
Last Day
0%
1
Compared to previous day
Last Week
133.3%
7
Compared to previous week
Last Month
16.7%
14
Compared to previous month
Last Year
12.5%
81
Compared to previous year
1
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.
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.
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:
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 }));
In case you have the following basic file structure
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 dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 3
Details
Reason
Found 2/16 approved changesets -- score normalized to 1
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
security policy file not detected
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
12 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-04-28
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