Gathering detailed insights and metrics for express-stream-compressed-static
Gathering detailed insights and metrics for express-stream-compressed-static
Gathering detailed insights and metrics for express-stream-compressed-static
Gathering detailed insights and metrics for express-stream-compressed-static
An expressjs middleware, to compress and stream static files
npm install express-stream-compressed-static
Typescript
Module System
Node Version
NPM Version
70.5
Supply Chain
94
Quality
75.3
Maintenance
100
Vulnerability
100
License
TypeScript (100%)
Total Downloads
760
Last Day
1
Last Week
2
Last Month
15
Last Year
98
1 Stars
9 Commits
2 Watchers
1 Branches
1 Contributors
Updated on Aug 14, 2022
Minified
Minified + Gzipped
Latest Version
0.0.2
Package Id
express-stream-compressed-static@0.0.2
Unpacked Size
16.81 kB
Size
5.25 kB
File Count
9
NPM Version
6.14.4
Node Version
14.1.0
Cumulative downloads
Total Downloads
Last Day
-75%
1
Compared to previous day
Last Week
-71.4%
2
Compared to previous week
Last Month
-21.1%
15
Compared to previous month
Last Year
11.4%
98
Compared to previous year
No dependencies detected.
An expressjs middleware, to compress and stream static files. Support brotli
and gzip
compression (if brotli is enabled, and user's browser also support, brotli use be used)
Table of contents:
1// import using require 2const serveStatic = require("express-stream-compressed-static") 3 4// import in ES6 5import serveStatic from "express-stream-compressed-static"; 6import path from "path" 7 8 9// ... your express app 10// const app = Express(); 11 12// Should be the first 13app.use("/static", serveStatic(path.join(__dirname, "../path-to-static-dir"))) 14 15// Or with options 16app.use("/static", serveStatic(path.join(__dirname, "../path-to-static-dir"), { 17 enableBrotli: boolean, 18 cacheControl: { 19 maxAge: numbe, 20 noTransform: boolean, 21 public: boolean, 22 additionalValue: string 23 } 24})) 25
express-stream-compressed-static
is available on npmjs, and can be install via npm
or yarn
as following (without $
ofcourse):
1# with npm
2$ npm i express-stream-compressed-static --save
3
4# with yarn
5$ yarn add express-stream-compressed-static
serveStatic(path: string, options: StaticHandlerOptions) => Function: Get the middleware handler to compress and stream static files
path
: path to the static directoryoptions
: see StaticHandlerOptions
belowtype StaticHandlerOptions
enableBrotli {boolean}
: enable brotli compress when client's browser supported. true
by default.cacheControl {StaticHandlerCacheOptions | optional}
: cache control optionscacheCompressedFiles {boolean | StaticHandlerCacheCompressedFilesOptions}
: cache compressed files to avoid re-compress filestype StaticHandlerCacheOptions
maxAge {number}
: add max-age
to cache control options (in seconds)noTransform {boolean}
: add no-transform
to cache control optionspublic {boolean}
: add public
to cache control optionsadditionalValue {string}
: add this value to cache control options
*For example, when maxAge
, noTransform
and public
is set, result will be Cache-Control: max-age=xxxx, no-transform, public
type StaticHandlerCacheCompressedFilesOptions
savePath {string}
: specify where the cache files will be stored. Otherwise, it will store file in same directory as the original fileexcludeQueryString {boolean}
: save compressed file name without queryString (false
by default). For example, your file url is path/bundle.js?v=0.0.1
and using brotli compression, when the value to true
, the filename will be save-path/bundle.js.br
. Otherwise, the filename will be save-path/bundle.js?v=0.0.1.br
MIT
options.cacheCompressedFiles
Feel free to start a thread for question, or feedback.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/9 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 SAST tool detected
Details
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
license file not detected
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-05-05
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