# @types/serve-index

> TypeScript definitions for serve-index

Latest version **1.9.4** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/serve-index
pnpm add @types/serve-index
yarn add @types/serve-index
bun add @types/serve-index
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.9.4 |
| Published | 2023-11-07 |
| First published | 2016-05-17 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51438 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/serve-index
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serve-index
- npm.io page: https://npm.io/package/@types/serve-index

## Dependencies (1)

- [@types/express](https://npm.io/package/@types/express.md) *

## Recent versions

- 1.9.4 (latest) — 2023-11-07
- 1.9.1 (ts3.6) — 2021-07-06
- 1.7.30 (ts2.3) — 2019-08-19
- 1.7.29 (ts2.2) — 2017-11-09
- 1.7.28 (ts2.0) — 2016-09-19
- 1.9.3 — 2023-10-18
- 1.9.2 — 2023-09-25
- 1.9.0 — 2021-06-23
- 1.7.27 — 2016-07-14
- 1.7.26-alpha — 2016-07-08
- 1.7.25-alpha — 2016-07-04
- 1.7.24-alpha — 2016-07-02
- 1.7.23-alpha — 2016-07-01
- 1.7.22-alpha — 2016-07-01
- 1.7.21-alpha — 2016-05-25
- … 3 more at https://npm.io/package/@types/serve-index/versions

## README

# Installation
> `npm install --save @types/serve-index`

# Summary
This package contains type definitions for serve-index (https://github.com/expressjs/serve-index).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serve-index.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/serve-index/index.d.ts)
````ts
import { Handler } from "express";
import { Stats } from "fs";

/** Serves pages that contain directory listings for a given path. */
declare function serveIndex(path: string, options?: serveIndex.Options): Handler;

declare namespace serveIndex {
    interface File {
        name: string;
        stat: Stats;
    }

    interface Locals {
        directory: string;
        displayIcons: boolean;
        fileList: File[];
        name: string;
        stat: Stats;
        path: string;
        style: string;
        viewName: string;
    }

    type TemplateCallback = (error: Error | null, htmlString?: string) => void;

    interface Options {
        filter?: ((filename: string, index: number, files: File[], dir: string) => boolean) | undefined;
        hidden?: boolean | undefined;
        icons?: boolean | undefined;
        stylesheet?: string | undefined;
        template?: string | ((locals: Locals, callback: TemplateCallback) => void) | undefined;
        view?: string | undefined;
    }
}

export = serveIndex;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 15:11:36 GMT
 * Dependencies: [@types/express](https://npmjs.com/package/@types/express)

# Credits
These definitions were written by [Tanguy Krotoff](https://github.com/tkrotoff).

---
_Source: https://npm.io/package/@types/serve-index · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
