New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@types/compression

Package Overview
Dependencies
Maintainers
1
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/compression - npm Package Compare versions

Comparing version 0.0.36 to 1.0.0

114

compression/index.d.ts

@@ -1,5 +0,6 @@

// Type definitions for compression
// Type definitions for compression 1.0
// Project: https://github.com/expressjs/compression
// Definitions by: Santi Albo <https://github.com/santialbo>
// Rob van der Burgt <https://github.com/rburgt>
// Neil Bryson Cargamento <https://github.com/neilbryson>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

@@ -10,2 +11,11 @@ // TypeScript Version: 2.2

/**
* Returns the compression middleware using the given `options`. The middleware will attempt to compress response bodies
* for all request that traverse through the middleware, based on the given `options`.
*
* This middleware will never compress responses that include a `Cache-Control` header with the `no-transform` directive,
* as compressing will transform the body.
*
* @see {@link https://github.com/expressjs/compression#compressionoptions|`compression([options]) documentation`}
*/
declare function e(options?: e.CompressionOptions): express.RequestHandler;

@@ -15,4 +25,23 @@

/**
* Default filter, used for extending filter given in CompressionOptions
* See https://github.com/expressjs/compression#filter-1 regarding the usage
* The default `filter` function. This is used to construct a custom filter function that is an extension of the default function.
*
* ```js
* 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)
* }
* ```
*
* @see {@link https://github.com/expressjs/compression#filter-1|`.filter` documentation}
*/

@@ -27,3 +56,5 @@ export function filter(req: express.Request, res: express.Response): boolean;

/**
* See https://github.com/expressjs/compression#chunksize regarding the usage.
* @default zlib.Z_DEFAULT_CHUNK or 16384
* @see {@link http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning| Node.js documentation}
* @see {@link https://github.com/expressjs/compression#chunksize|chunkSize documentation}
*/

@@ -33,3 +64,25 @@ chunkSize?: number;

/**
* See https://github.com/expressjs/compression#level regarding the usage.
* The level of zlib compression to apply to responses. A higher level will result in better compression, but
* will take longer to complete. A lower level will result in less compression, but will be much faster.
*
* This is an integer in the range of `0` (no compression) to `9` (maximum compression). The special value `-1`
* can be used to mean the "default compression level", which is a default compromise between speed and
* compression (currently equivalent to level 6).
*
* - `-1` Default compression level (also `zlib.Z_DEFAULT_COMPRESSION`).
* - `0` No compression (also `zlib.Z_NO_COMPRESSION`).
* - `1` Fastest compression (also `zlib.Z_BEST_SPEED`).
* - `2`
* - `3`
* - `4`
* - `5`
* - `6` (currently what `zlib.Z_DEFAULT_COMPRESSION` points to).
* - `7`
* - `8`
* - `9` Best compression (also `zlib.Z_BEST_COMPRESSION`).
*
* **Note** in the list above, `zlib` is from `zlib = require('zlib')`.
*
* @default zlib.DEFAULT_COMPRESSION or -1
* @see {@link https://github.com/expressjs/compression#level|`level` documentation}
*/

@@ -39,3 +92,8 @@ level?: number;

/**
* See https://github.com/expressjs/compression#memlevel regarding the usage.
* 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).
*
* @default zlib.DEFAULT_MEMLEVEL or 8
* @see {@link http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning|Node.js documentation}
* @see {@link https://github.com/expressjs/compression#memlevel|`memLevel` documentation}
*/

@@ -45,3 +103,16 @@ memLevel?: number;

/**
* See https://github.com/expressjs/compression#strategy regarding the usage.
* 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')`.
*/

@@ -51,3 +122,11 @@ strategy?: number;

/**
* See https://github.com/expressjs/compression#threshold regarding the usage.
* The byte threshold for the response body size before compression is considered for the response, defaults to
* 1kb. This is a number of bytes or any string accepted by the bytes module.
*
* **Note** this is only an advisory setting; if the response size cannot be determined at the time the response
* headers are written, then it is assumed the response is *over* the threshold. To guarantee the response size
* can be determined, be sure set a `Content-Length` response header.
*
* @see {@link https://www.npmjs.com/package/bytes|`bytes` module}
* @see {@link https://github.com/expressjs/compression#threshold|`threshold` documentation}
*/

@@ -57,3 +136,4 @@ threshold?: number | string;

/**
* See https://github.com/expressjs/compression#windowbits regarding the usage.
* @default zlib.Z_DEFAULT_WINDOWBITS or 15.
* @see {@link http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning|Node.js documentation}
*/

@@ -63,3 +143,11 @@ windowBits?: number;

/**
* See https://github.com/expressjs/compression#filter regarding the usage.
* A function to decide if the response should be considered for compression. This function is called as
* `filter(req, res)` and is expected to return `true` to consider the response for compression, or `false` to
* not compress the response.
*
* The default filter function uses the `compressible` module to determine if `res.getHeader('Content-Type')`
* is compressible.
*
* @see {@link https://github.com/expressjs/compression#filter|`filter` documentation}
* @see {@link https://www.npmjs.com/package/compressible|compressible module}
*/

@@ -69,3 +157,4 @@ filter?: CompressionFilter;

/**
* See https://nodejs.org/api/zlib.html#zlib_class_options regarding the usage.
* @default zlib.Z_NO_FLUSH
* @see {@link https://nodejs.org/api/zlib.html#zlib_class_options|Zlib class options}
*/

@@ -75,3 +164,4 @@ flush?: number;

/**
* See https://nodejs.org/api/zlib.html#zlib_class_options regarding the usage.
* @default zlib.Z_FINISH
* @see {@link https://nodejs.org/api/zlib.html#zlib_class_options|Zlib class options}
*/

@@ -78,0 +168,0 @@ finishFlush?: number;

13

compression/package.json
{
"name": "@types/compression",
"version": "0.0.36",
"version": "1.0.0",
"description": "TypeScript definitions for compression",

@@ -16,8 +16,15 @@ "license": "MIT",

"githubUsername": "rburgt"
},
{
"name": "Neil Bryson Cargamento",
"url": "https://github.com/neilbryson",
"githubUsername": "neilbryson"
}
],
"main": "",
"types": "index",
"repository": {
"type": "git",
"url": "https://www.github.com/DefinitelyTyped/DefinitelyTyped.git"
"url": "https://github.com/DefinitelyTyped/DefinitelyTyped.git",
"directory": "types/compression"
},

@@ -28,4 +35,4 @@ "scripts": {},

},
"typesPublisherContentHash": "82b6ce8afc249271e034184055dd1ae18cfb6996033799ae10111c30063600fa",
"typesPublisherContentHash": "86e5ec39baa1af45b828c2779b9aca55b101ff7e08a21f638c754850b6e26372",
"typeScriptVersion": "2.2"
}

@@ -8,10 +8,10 @@ # Installation

# Details
Files were exported from https://www.github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/compression
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/compression
Additional Details
* Last updated: Thu, 15 Mar 2018 23:17:55 GMT
* Dependencies: express
* Last updated: Mon, 05 Aug 2019 17:23:51 GMT
* Dependencies: @types/express
* Global values: none
# Credits
These definitions were written by Santi Albo <https://github.com/santialbo>, Rob van der Burgt <https://github.com/rburgt>.
These definitions were written by Santi Albo <https://github.com/santialbo>, Rob van der Burgt <https://github.com/rburgt>, and Neil Bryson Cargamento <https://github.com/neilbryson>.

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc