UNPKG

1.16 kBTypeScriptView Raw
1// Type definitions for serve-index v1.7.2
2// Project: https://github.com/expressjs/serve-index
3// Definitions by: Tanguy Krotoff <https://github.com/tkrotoff>
4// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5// TypeScript Version: 2.3
6
7
8
9
10import * as express from 'express';
11import * as fs from 'fs';
12
13declare namespace serveIndex {
14 interface File {
15 name: string;
16 stat: fs.Stats;
17 }
18
19 interface Locals {
20 directory: string;
21 displayIcons: boolean;
22 fileList: Array<File>;
23 name: string;
24 stat: fs.Stats;
25 path: string;
26 style: string;
27 viewName: string;
28 }
29
30 type templateCallback = (error: Error, htmlString?: string) => void;
31
32 interface Options {
33 filter?: (filename: string, index: number, files: Array<File>, dir: string) => boolean;
34 hidden?: boolean;
35 icons?: boolean;
36 stylesheet?: string;
37 template?: string | ((locals: Locals, callback: templateCallback) => void);
38 view?: string;
39 }
40}
41
42declare function serveIndex(path: string, options?: serveIndex.Options): express.Handler;
43
44export = serveIndex;
45
\No newline at end of file