# static-handler

> A very simple static files handler

Latest version **0.5.3** (published 2024-09-12) · ISC license · 0 weekly downloads

## Install

```sh
npm install static-handler
pnpm add static-handler
yarn add static-handler
bun add static-handler
```

Provides the command `static-handler`.

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.5.3 |
| Published | 2024-09-12 |
| First published | 2021-11-29 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Node | >=16 |
| Dependencies | 0 |
| Unpacked size | 59.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | Andrea Giammarchi |
| Maintainers | webreflection |
| Keywords | static, handler, server |

## Links

- npm: https://www.npmjs.com/package/static-handler
- Repository: https://github.com/WebReflection/static-handler
- Homepage: https://github.com/WebReflection/static-handler#readme
- Issues: https://github.com/WebReflection/static-handler/issues
- npm.io page: https://npm.io/package/static-handler

## Recent versions

- 0.5.3 (latest) — 2024-09-12
- 0.5.2 — 2024-09-11
- 0.5.1 — 2024-09-10
- 0.5.0 — 2024-09-09
- 0.4.3 — 2023-10-09
- 0.4.2 — 2023-06-22
- 0.4.1 — 2023-06-08
- 0.4.0 — 2023-06-05
- 0.3.2 — 2023-04-20
- 0.3.1 — 2022-05-23
- 0.3.0 — 2021-12-28
- 0.2.0 — 2021-12-10
- 0.1.4 — 2021-12-02
- 0.1.3 — 2021-12-02
- 0.1.2 — 2021-12-02
- … 4 more at https://npm.io/package/static-handler/versions

## README

# static-handler

A very simple static files handler, useful for testing, debugging purpose, or whenever a very basic static file server is needed as fallback/resource.

```sh
# as CLI
npx static-handler --help
```

```js
// as utility
const staticHandler = require('static-handler');

const handled = staticHandler(__dirname);

require('http').createServer((req, res) => {
  // handled as static content, returns true
  if (handled(req, res))
    return;

  // do anything else
}).listen(8080);
```

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