Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 29, 2024 via pnpm

compression 1.5.2

Node.js compression middleware
Package summary
Share
5
issues
1
critical severity
license
1
2
high severity
vulnerability
2
2
moderate severity
vulnerability
2
2
licenses
10
MIT
1
N/A
Package created
1 Jan 2014
Version published
31 Jul 2015
Maintainers
1
Total deps
11
Direct deps
6
License
MIT

Issues

5

1 critical severity issue

critical
Recommendation: Check the package code and files for license information
via: debug@2.2.0
Collapse
Expand

2 high severity issues

high
Recommendation: Upgrade to version 0.6.1 or later
via: accepts@1.2.13
Recommendation: Upgrade to version 2.6.9 or later
via: debug@2.2.0
Collapse
Expand

2 moderate severity issues

moderate
Recommendation: Upgrade to version 2.6.9 or later
via: debug@2.2.0
Recommendation: Upgrade to version 2.0.0 or later
via: debug@2.2.0
Collapse
Expand

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
10 Packages, Including:
accepts@1.2.13
bytes@2.1.0
compressible@2.0.18
compression@1.5.2
debug@2.2.0
mime-db@1.52.0
mime-types@2.1.35
negotiator@0.5.3
on-headers@1.0.2
vary@1.0.1

N/A

N/A
1 Packages, Including:
ms@0.7.1
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

6
All Dependencies CSV
β“˜ This is a list of compression 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
accepts1.2.134.7 kBMIT
prod
1
bytes2.1.02.31 kBMIT
prod
compressible2.0.183 kBMIT
prod
debug2.2.010.05 kBMIT
prod
1
1
2
on-headers1.0.23.15 kBMIT
prod
vary1.0.13 kBMIT
prod

Visualizations

Frequently Asked Questions

What does compression do?

The "compression" is a Node.js middleware that aims to compress response bodies for all requests that go through the middleware. It supports two compression codings: "deflate" and "gzip". This is handy for efficient data handling in your Node.js web application, resulting in decreased load times and improved performance due to less data being transferred over the network.

How do you use compression?

To install the "compression" middleware, simply use the npm install command in your terminal like so:

$ npm install compression

Then, you require the compression middleware and use it in your application as illustrated in the following example:

var compression = require('compression')
var express = require('express')

var app = express()

// compress all responses
app.use(compression())

// add all routes

This example demonstrates compression being used with the Express.js library. By using the middleware via the app.use(compression()) call, all responses of your Express.js application will be compressed.

For more advanced usage, you can customise the behaviour by passing an options object to the compression function as demonstrated:

var compression = require('compression')
var express = require('express')

var app = express()
app.use(compression({ filter: shouldCompress }))

function shouldCompress (req, res) {
  if (req.headers['x-no-compression']) {
    // don't compress responses with this request header
    return false
  }

  // fallback to standard filter function
  return compression.filter(req, res)
}

In this example, the filter option is used to determine whether the response should be compressed or not.

Where are the compression docs?

For comprehensive information about the compression middleware, the API, and various usage scenarios, it is best to refer to the official GitHub repository at git+https://github.com/expressjs/compression.git. There is no separate documentation site, but the readme file in the GitHub repo provides extensive information, including more detailed code examples and a full rundown of all the possible configuration options and their usage. The module can also be found on npm at https://npmjs.org/package/compression.