-
-
Notifications
You must be signed in to change notification settings - Fork 175
Expand file tree
/
Copy pathindex.d.ts
More file actions
37 lines (34 loc) · 848 Bytes
/
index.d.ts
File metadata and controls
37 lines (34 loc) · 848 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import type { IncomingMessage, ServerResponse } from 'node:http';
export type Options = {
/**
* Don't compress responses below this size (in bytes).
* @default 1024
*/
threshold?: number;
/**
* Gzip/Brotli compression effort (1-11, or -1 for default)
* @default -1
*/
level?: number;
/**
* Generate and serve Brotli-compressed responses.
* @default false
*/
brotli?: boolean;
/**
* Generate and serve Gzip-compressed responses.
* @default true
*/
gzip?: boolean;
/**
* Regular expression of response MIME types to compress.
* @default /text|javascript|\/json|xml/i
*/
mimes?: RegExp;
};
export type Middleware = (
request: Pick<IncomingMessage, 'method' | 'headers'>,
response: ServerResponse,
next?: (error?: Error | string) => any,
) => void;
export default function (options?: Options): Middleware;