Gathering detailed insights and metrics for express-json-compress
Gathering detailed insights and metrics for express-json-compress
Gathering detailed insights and metrics for express-json-compress
Gathering detailed insights and metrics for express-json-compress
Module gzip's json data and sends decompressed content length by header
npm install express-json-compress
Typescript
Module System
Node Version
NPM Version
JavaScript (58.44%)
TypeScript (41.56%)
Total Downloads
5,446
Last Day
3
Last Week
11
Last Month
89
Last Year
806
MIT License
6 Commits
1 Branches
1 Contributors
Updated on Feb 13, 2019
Minified
Minified + Gzipped
Latest Version
1.2.2
Package Id
express-json-compress@1.2.2
Unpacked Size
10.95 kB
Size
3.94 kB
File Count
7
NPM Version
5.5.1
Node Version
8.9.1
Cumulative downloads
Total Downloads
Last Day
-25%
3
Compared to previous day
Last Week
-26.7%
11
Compared to previous week
Last Month
-53.2%
89
Compared to previous month
Last Year
-15.9%
806
Compared to previous year
1
1
Module gzip's json data and sends decompressed content length by headers
npm install --save express-json-compressor
or
yarn install express-json-compressor
1const jsonCompress = require("express-json-compress");
or
1import * as jsonCompress from "express-json-compress";
This compressor creates response header x-decompressed-content-length, which helps to calculate ajax download progress in client side. Check example below.
Important
Disable or filter out other compressors for json data.
1const express = require("express"); 2const app = express(); 3const jsonCompress = require("express-json-compress"); 4 5app.use(jsonCompress); // add json compress middleware 6 7app.get("/api", function(req, res) { 8 var jsonObject = { foo: "bar" }; 9 var jsonString = JSON.stringify(jsonObject); 10 // send compressed json data with header 11 res.compressJson(jsonString); 12}); 13 14app.listen(3000, function() { 15 console.log("Example app listening on port 3000!"); 16});
1var req = new XMLHttpRequest(); 2req.onprogress = updateProgress; 3req.open("GET", "/api", true); 4 5req.onprogress = function(event) { 6 var contentLength; 7 if (e.lengthComputable) { 8 contentLength = e.total; 9 } else { 10 contentLength = e.target.getResponseHeader( 11 "x-decompressed-content-length" 12 ); 13 } 14 if (!contentLength) return; 15 var progress = (e.loaded / contentLength) * 100.0; 16 //use progress in percentage 17 //... 18}; 19 20req.onreadystatechange = function(event) { 21 //.... 22}; 23 24req.send();
Edvinas pranka
The MIT License (MIT)
Copyright (c) 2019 Edvinas Pranka
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 0/6 approved changesets -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
0 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
project is not fuzzed
Details
Reason
security policy 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