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 1.0.1 to 1.7.0

103

compression/index.d.ts

@@ -1,2 +0,2 @@

// Type definitions for compression 1.0
// Type definitions for compression 1.7
// Project: https://github.com/expressjs/compression

@@ -6,7 +6,19 @@ // Definitions by: Santi Albo <https://github.com/santialbo>

// Neil Bryson Cargamento <https://github.com/neilbryson>
// Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
import * as express from 'express';
import express = require('express');
// This module adds a res.flush() method to force the partially-compressed response to be flushed to the client.
declare global {
namespace Express {
interface Response {
/**
* Forces the partially-compressed response to be flushed to the client.
*/
flush(): void;
}
}
}
/**

@@ -21,5 +33,5 @@ * Returns the compression middleware using the given `options`. The middleware will attempt to compress response bodies

*/
declare function e(options?: e.CompressionOptions): express.RequestHandler;
declare function compression(options?: compression.CompressionOptions): express.RequestHandler;
declare namespace e {
declare namespace compression {
/**

@@ -48,4 +60,7 @@ * The default `filter` function. This is used to construct a custom filter function that is an extension of the default function.

*/
export function filter(req: express.Request, res: express.Response): boolean;
function filter(req: express.Request, res: express.Response): boolean;
/**
* A function to decide if the response should be considered for compression.
*/
interface CompressionFilter {

@@ -55,5 +70,9 @@ (req: express.Request, res: express.Response): boolean;

/**
* compression() accepts these properties in the options object.
* In addition to those listed below, `zlib` options may be passed in to the options object.
*/
interface CompressionOptions {
/**
* @default zlib.Z_DEFAULT_CHUNK or 16384
* @default zlib.constants.Z_DEFAULT_CHUNK or 16384
* @see {@link http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning| Node.js documentation}

@@ -65,2 +84,15 @@ * @see {@link https://github.com/expressjs/compression#chunksize|chunkSize documentation}

/**
* 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}
*/
filter?: CompressionFilter;
/**
* The level of zlib compression to apply to responses. A higher level will result in better compression, but

@@ -73,5 +105,5 @@ * will take longer to complete. A lower level will result in less compression, but will be much faster.

*
* - `-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`).
* - `-1` Default compression level (also `zlib.constants.Z_DEFAULT_COMPRESSION`).
* - `0` No compression (also `zlib.constants.Z_NO_COMPRESSION`).
* - `1` Fastest compression (also `zlib.constants.Z_BEST_SPEED`).
* - `2`

@@ -81,10 +113,10 @@ * - `3`

* - `5`
* - `6` (currently what `zlib.Z_DEFAULT_COMPRESSION` points to).
* - `6` (currently what `zlib.constants.Z_DEFAULT_COMPRESSION` points to).
* - `7`
* - `8`
* - `9` Best compression (also `zlib.Z_BEST_COMPRESSION`).
* - `9` Best compression (also `zlib.constants.Z_BEST_COMPRESSION`).
*
* **Note** in the list above, `zlib` is from `zlib = require('zlib')`.
*
* @default zlib.DEFAULT_COMPRESSION or -1
* @default zlib.constants.DEFAULT_COMPRESSION or -1
* @see {@link https://github.com/expressjs/compression#level|`level` documentation}

@@ -98,3 +130,3 @@ */

*
* @default zlib.DEFAULT_MEMLEVEL or 8
* @default zlib.constants.DEFAULT_MEMLEVEL or 8
* @see {@link http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning|Node.js documentation}

@@ -109,11 +141,11 @@ * @see {@link https://github.com/expressjs/compression#memlevel|`memLevel` documentation}

*
* - `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
* - `zlib.constants.Z_DEFAULT_STRATEGY` Use for normal data.
* - `zlib.constants.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.
* between `zlib.constants.Z_DEFAULT_STRATEGY` and `zlib.constants.Z_HUFFMAN_ONLY`.
* - `zlib.constants.Z_FIXED` Use to prevent the use of dynamic Huffman codes, allowing for a simpler decoder for special applications.
* - `zlib.constants.Z_HUFFMAN_ONLY` Use to force Huffman encoding only (no string match).
* - `zlib.constants.Z_RLE` Use to limit match distances to one (run-length encoding). This is designed to be almost as
* fast as `zlib.constants.Z_HUFFMAN_ONLY`, but give better compression for PNG image data.
*

@@ -138,34 +170,13 @@ * **Note** in the list above, `zlib` is from `zlib = require('zlib')`.

/**
* @default zlib.Z_DEFAULT_WINDOWBITS or 15.
* @default zlib.constants.Z_DEFAULT_WINDOWBITS or 15.
* @see {@link http://nodejs.org/api/zlib.html#zlib_memory_usage_tuning|Node.js documentation}
*/
windowBits?: number;
/**
* 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}
* In addition , `zlib` options may be passed in to the options object.
*/
filter?: CompressionFilter;
/**
* @default zlib.Z_NO_FLUSH
* @see {@link https://nodejs.org/api/zlib.html#zlib_class_options|Zlib class options}
*/
flush?: number;
/**
* @default zlib.Z_FINISH
* @see {@link https://nodejs.org/api/zlib.html#zlib_class_options|Zlib class options}
*/
finishFlush?: number;
[property: string]: any;
}
}
export = e;
export = compression;
{
"name": "@types/compression",
"version": "1.0.1",
"version": "1.7.0",
"description": "TypeScript definitions for compression",

@@ -21,6 +21,11 @@ "license": "MIT",

"githubUsername": "neilbryson"
},
{
"name": "Piotr Błażejewicz",
"url": "https://github.com/peterblazejewicz",
"githubUsername": "peterblazejewicz"
}
],
"main": "",
"types": "index",
"types": "index.d.ts",
"repository": {

@@ -35,4 +40,4 @@ "type": "git",

},
"typesPublisherContentHash": "5c3ee7c35a1b6f0ad90835af905a758a8beee8a863c1fdbd169ee947fc30da20",
"typeScriptVersion": "2.3"
"typesPublisherContentHash": "895e65ff68cfb7837d5b15a9741de8c3047f707bebaacea6933207a5ce09fa82",
"typeScriptVersion": "2.8"
}

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

# Details
Files were exported from https://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: Mon, 19 Aug 2019 00:51:08 GMT
* Dependencies: @types/express
### Additional Details
* Last updated: Fri, 07 Feb 2020 22:12:30 GMT
* Dependencies: [@types/express](https://npmjs.com/package/@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>, and Neil Bryson Cargamento <https://github.com/neilbryson>.
These definitions were written by Santi Albo (https://github.com/santialbo), Rob van der Burgt (https://github.com/rburgt), Neil Bryson Cargamento (https://github.com/neilbryson), and Piotr Błażejewicz (https://github.com/peterblazejewicz).
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