UNPKG

1.03 kBTypeScriptView Raw
1import { Handler } from "express";
2import { Stats } from "fs";
3
4/** Serves pages that contain directory listings for a given path. */
5declare function serveIndex(path: string, options?: serveIndex.Options): Handler;
6
7declare namespace serveIndex {
8 interface File {
9 name: string;
10 stat: Stats;
11 }
12
13 interface Locals {
14 directory: string;
15 displayIcons: boolean;
16 fileList: File[];
17 name: string;
18 stat: Stats;
19 path: string;
20 style: string;
21 viewName: string;
22 }
23
24 type TemplateCallback = (error: Error | null, htmlString?: string) => void;
25
26 interface Options {
27 filter?: ((filename: string, index: number, files: File[], dir: string) => boolean) | undefined;
28 hidden?: boolean | undefined;
29 icons?: boolean | undefined;
30 stylesheet?: string | undefined;
31 template?: string | ((locals: Locals, callback: TemplateCallback) => void) | undefined;
32 view?: string | undefined;
33 }
34}
35
36export = serveIndex;
37
\No newline at end of file