mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-31 03:02:04 +08:00
Add type definitions for shrink-ray
This commit is contained in:
54
types/shrink-ray/index.d.ts
vendored
Normal file
54
types/shrink-ray/index.d.ts
vendored
Normal file
@@ -0,0 +1,54 @@
|
||||
// Type definitions for shrink-ray 0.1
|
||||
// Project: https://github.com/aickin/shrink-ray
|
||||
// Definitions by: forabi <https://github.com/forabi>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.3
|
||||
|
||||
import { RequestHandler, Request, Response } from 'express';
|
||||
import * as zlib from 'zlib';
|
||||
type FilterFunction = (req: Request, res: Response) => boolean;
|
||||
|
||||
type Options = Partial<{
|
||||
cacheSize: number;
|
||||
threshold: number;
|
||||
zlib: Partial<{
|
||||
/** default: zlib.constants.Z_NO_FLUSH */
|
||||
flush?: number;
|
||||
|
||||
/** default: zlib.constants.Z_FINISH */
|
||||
finishFlush?: number;
|
||||
|
||||
/** default: 16*1024 */
|
||||
chunkSize?: number;
|
||||
windowBits?: number;
|
||||
|
||||
/** compression only */
|
||||
strategy?: number;
|
||||
|
||||
/** deflate/inflate only, empty dictionary by default */
|
||||
dictionary?: any;
|
||||
|
||||
/** compression only */
|
||||
level: -1 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
||||
|
||||
/** compression only */
|
||||
memLevel: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9;
|
||||
}>;
|
||||
brotli: {
|
||||
lgblock: number;
|
||||
lgwin: number;
|
||||
mode: 0 | 1 | 2;
|
||||
quality: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11;
|
||||
};
|
||||
filter: FilterFunction;
|
||||
cache(req: Request, res: Response): boolean;
|
||||
}>;
|
||||
|
||||
interface CreateMiddleware {
|
||||
(options?: Options): RequestHandler;
|
||||
filter: FilterFunction;
|
||||
}
|
||||
|
||||
declare const createMiddleware: CreateMiddleware;
|
||||
|
||||
export = createMiddleware;
|
||||
6
types/shrink-ray/shrink-ray-tests.ts
Normal file
6
types/shrink-ray/shrink-ray-tests.ts
Normal file
@@ -0,0 +1,6 @@
|
||||
import * as express from 'express';
|
||||
import * as shrinkRay from 'shrink-ray';
|
||||
|
||||
const app = express();
|
||||
|
||||
app.use(shrinkRay());
|
||||
22
types/shrink-ray/tsconfig.json
Normal file
22
types/shrink-ray/tsconfig.json
Normal file
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"shrink-ray-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/shrink-ray/tslint.json
Normal file
1
types/shrink-ray/tslint.json
Normal file
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user