# deliver

> Deliver local and remote static files

Latest version **1.1.11** (published 2015-03-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install deliver
pnpm add deliver
yarn add deliver
bun add deliver
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.11 |
| Published | 2015-03-19 |
| First published | 2014-01-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 10 |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| GitHub stars | 5 |
| Author | Scott Corgan |
| Maintainers | scottcorgan |
| Keywords | static, remote, files, serve |

## Links

- npm: https://www.npmjs.com/package/deliver
- Repository: https://github.com/scottcorgan/deliver
- Issues: https://github.com/scottcorgan/deliver/issues
- npm.io page: https://npm.io/package/deliver

## Dependencies (10)

- [send](https://npm.io/package/send.md) ^0.12.2
- [is-url](https://npm.io/package/is-url.md) ^1.2.0
- [accepts](https://npm.io/package/accepts.md) ^1.2.5
- [defaults](https://npm.io/package/defaults.md) ^1.0.2
- [join-path](https://npm.io/package/join-path.md) ^1.0.0
- [hyperquest](https://npm.io/package/hyperquest.md) ^1.0.1
- [mime-types](https://npm.io/package/mime-types.md) ^2.0.10
- [on-headers](https://npm.io/package/on-headers.md) ^1.0.0
- [compressible](https://npm.io/package/compressible.md) ^2.0.2
- [fast-url-parser](https://npm.io/package/fast-url-parser.md) ^1.1.3

## Alternatives

- [unionfs](https://npm.io/package/unionfs.md) — 2.2M weekly downloads
- [path-starts-with](https://npm.io/package/path-starts-with.md) — 35.9K weekly downloads
- [redzip](https://npm.io/package/redzip.md) — 1.2K weekly downloads
- [vscode-anymatch](https://npm.io/package/vscode-anymatch.md) — 848 weekly downloads
- [@ledgerhq/coin-filecoin](https://npm.io/package/@ledgerhq/coin-filecoin.md) — 793 weekly downloads

## Recent versions

- 1.1.11 (latest) — 2015-03-19
- 0.4.6-rc2 (0.4.6-rc2) — 2014-08-21
- 0.4.6-rc1 (0.4.6-rc1) — 2014-08-21
- 1.1.10 — 2014-11-07
- 1.1.9 — 2014-11-07
- 1.1.7 — 2014-09-29
- 1.1.6 — 2014-09-29
- 1.1.5 — 2014-09-29
- 1.1.4 — 2014-09-22
- 1.1.3 — 2014-09-18
- 1.1.2 — 2014-09-17
- 1.1.1 — 2014-09-17
- 1.1.0 — 2014-09-17
- 1.0.2 — 2014-09-11
- 1.0.1 — 2014-09-11
- … 23 more at https://npm.io/package/deliver/versions

## README

# deliver

Serve local and remote static files.

## Install

```
npm install deliver --save
```

## Usage

#### Local file

```js
var deliver = require('deliver');
var http = require('http');

http.createServer(function (req, res) {
  // Conditionally set the request url
  req.url = '/some';
  
  deliver(req, res, {
    root: process.cwd() // OPTIONAL
  }).pipe(res);
  
}).listen(3000);
```

#### Remote file (proxy)

```js
var deliver = require('deliver');
var http = require('http');

http.createServer(function (req, res) {
  // Conditionally set the request url
  req.url = '/somefile.html';
  
  deliver(req, res, {
    root: 'http://www.somewhere.com'
  }).pipe(res);
  
}).listen(3000);
```

## deliver(req, res,[, options])

Returns a stream almost identical to the [`send` module](https://www.npmjs.org/package/send). That means you can listen to the same events (i.e. *directory*, *error*, etc).

* `req` - the request object
* `res` - the response object
* `options`
  * `root` - set the root directory that holds the static files to serve. This can be a path or a url
  * `index` - set a custom index file. Pass `false` to disable or pass a string or array of strings for a custom index file.
  * `contentType` - override the content type
  
## Run Tests

```
npm install
npm test
```

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