Socket
Socket
Sign inDemoInstall

compression

Package Overview
Dependencies
10
Maintainers
7
Versions
36
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.3.1 to 1.4.0

6

HISTORY.md

@@ -0,1 +1,7 @@

1.4.0 / 2015-02-01
==================
* Prefer `gzip` over `deflate` on the server
- Not all clients agree on what "deflate" coding means
1.3.1 / 2015-01-31

@@ -2,0 +8,0 @@ ==================

@@ -162,2 +162,7 @@ /*!

// we really don't prefer deflate
if (method === 'deflate' && accept.encoding(['gzip'])) {
method = accept.encoding(['gzip', 'identity'])
}
// negotiation failed

@@ -164,0 +169,0 @@ if (!method || method === 'identity') {

2

package.json
{
"name": "compression",
"description": "Node.js compression middleware",
"version": "1.3.1",
"version": "1.4.0",
"author": "Jonathan Ong <me@jongleberry.com> (http://jongleberry.com)",

@@ -6,0 +6,0 @@ "contributors": [

@@ -11,2 +11,7 @@ # compression

The following compression codings are supported:
- deflate
- gzip
## Install

@@ -24,12 +29,6 @@

### compression(options)
### compression([options])
Returns the compression middleware using the given `options`.
```js
app.use(compression({
threshold: 512
}))
```
#### Options

@@ -41,2 +40,9 @@

##### chunkSize
The default value is `zlib.Z_DEFAULT_CHUNK`, or `16384`.
See [Node.js documentation](http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
regarding the usage.
##### filter

@@ -74,4 +80,39 @@

The default value is `zlib.Z_DEFAULT_COMPRESSION`, or `-1`.
**Note** in the list above, `zlib` is from `zlib = require('zlib')`.
##### memLevel
This specifies how much memory should be allocated for the internal compression
state and is an integer in the range of `1` (minimum level) and `9` (maximum
level).
The default value is `zlib.Z_DEFAULT_MEMLEVEL`, or `8`.
See [Node.js documentation](http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
regarding the usage.
##### strategy
This is used to tune the compression algorithm. This value only affects the
compression ratio, not the correctness of the compressed output, even if it
is not set appropriately.
- `zlib.Z_DEFAULT_STRATEGY` Use for normal data.
- `zlib.Z_FILTERED` Use for data produced by a filter (or predictor).
Filtered data consists mostly of small values with a somewhat random
distribution. In this case, the compression algorithm is tuned to
compress them better. The effect is to force more Huffman coding and less
string matching; it is somewhat intermediate between `zlib.Z_DEFAULT_STRATEGY`
and `zlib.Z_HUFFMAN_ONLY`.
- `zlib.Z_FIXED` Use to prevent the use of dynamic Huffman codes, allowing
for a simpler decoder for special applications.
- `zlib.Z_HUFFMAN_ONLY` Use to force Huffman encoding only (no string match).
- `zlib.Z_RLE` Use to limit match distances to one (run-length encoding).
This is designed to be almost as fast as `zlib.Z_HUFFMAN_ONLY`, but give
better compression for PNG image data.
**Note** in the list above, `zlib` is from `zlib = require('zlib')`.
##### threshold

@@ -83,2 +124,9 @@

##### windowBits
The default value is `zlib.Z_DEFAULT_WINDOWBITS`, or `15`.
See [Node.js documentation](http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning)
regarding the usage.
#### .filter

@@ -85,0 +133,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc