# io-serve

> npx-compatible REST API for simple file i/o over HTTP.

Latest version **1.1.2** (published 2020-09-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install io-serve
pnpm add io-serve
yarn add io-serve
bun add io-serve
```

Provides the command `io-serve`.

## 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.2 |
| Published | 2020-09-29 |
| First published | 2019-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 6 |
| Unpacked size | 12.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 4 |
| Author | evaera |
| Maintainers | evaera |
| Keywords | static server, io server, save server, file save server, file write server |

## Links

- npm: https://www.npmjs.com/package/io-serve
- Repository: https://github.com/evaera/io-serve
- Homepage: https://github.com/evaera/io-serve#readme
- Issues: https://github.com/evaera/io-serve/issues
- npm.io page: https://npm.io/package/io-serve

## Dependencies (6)

- [chalk](https://npm.io/package/chalk.md) ^2.4.2
- [yargs](https://npm.io/package/yargs.md) ^12.0.5
- [express](https://npm.io/package/express.md) ^4.16.4
- [fs-extra](https://npm.io/package/fs-extra.md) ^7.0.1
- [body-parser](https://npm.io/package/body-parser.md) ^1.18.3
- [method-override](https://npm.io/package/method-override.md) ^3.0.0

## Recent versions

- 1.1.2 (latest) — 2020-09-29
- 1.1.1 — 2020-06-22
- 1.1.0 — 2019-02-15
- 1.0.0 — 2019-02-14

## README

# io-serve

npx-compatible REST API for simple file i/o over HTTP.

Run `npx io-serve` inside any directory -- now you have a server running at `http://localhost:33333`.

| Verb | Action
| ------ | -------------
| GET | Returns the corresponding file descending from the current working directory
| HEAD | Same as GET, but returns no file data, only headers and status code.
| PUT | Write the request body to the corresponding file. Directories are automatically created.
| PATCH | Append the request body to the corresponding file. Directories are automatically created.
| DELETE | Delete the corresponding file or directory.
| POST | Unimplemented.

If you GET a directory, you will receive a JSON array of the files and directories inside. Directory names in the listing are appended with a `/`.\
You can distinguish files from directories with the `X-Resource-Type` header which is either `file` or `directory`.

If you GET a path that doesn't exist, the status code will be `404`. If you GET something that isn't a file or directory (like a socket) the status code will be `415`.

If you PATCH or PUT to a directory, the directory will be deleted and a new file will be created in its place.

For environments that do not support the preceding methods, you can instead send a POST request specifying the `X-HTTP-Method-Override` header set to the uppercase method name you wish to override.

## Options

```
Usage: io-serve [options]

Options:
  --bind, -b     The network address to bind upon                       [string]
  --port, -p     Port to start server on               [number] [default: 33333]
  -v, --version  show version information                              [boolean]
  -h, --help     show help                                             [boolean]
```

## Why?

Some embedded environments allow access to HTTP requests but not the filesystem. io-serve bridges that gap.

## Be safe
By default, io-serve only binds to `localhost`, which will prevent outside connections. While it is possible to bind on external addresses with the `-b` option, it should only be done with great care.

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