# koa-formidable

> Formidable middleware for Koa

Latest version **1.1.0** (published 2017-04-29) · 0 weekly downloads

## Install

```sh
npm install koa-formidable
pnpm add koa-formidable
yarn add koa-formidable
bun add koa-formidable
```

## 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.0 |
| Published | 2017-04-29 |
| First published | 2014-01-15 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=0.8 |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 25 |
| Author | Markus Ast |
| Maintainers | rkusa |
| Keywords | koa, formidable, form, upload, multipart, bodyparser |

## Links

- npm: https://www.npmjs.com/package/koa-formidable
- Repository: https://github.com/rkusa/koa-formidable
- Issues: https://github.com/rkusa/koa-formidable/issues
- npm.io page: https://npm.io/package/koa-formidable

## Dependencies (1)

- [formidable](https://npm.io/package/formidable.md) ^1.1.1

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2017-04-29
- 1.0.0 — 2014-07-29
- 0.1.0 — 2014-01-15

## README

# koa-formidable

[Formidable](https://github.com/felixge/node-formidable) middleware for Koa

[![NPM][npm]](https://npmjs.org/package/koa-formidable)
[![Dependency Status][dependencies]](https://david-dm.org/rkusa/koa-formidable)

**Breaking Change in 1.0.0:** both `body` and `files` are now added to Koa's `.request` instead of modifying the http request (`.req`) directly.

## API

`var formidable = require('koa-formidable')`

### formidable(opts)

Returns the formidable middleware that parses the incoming request and adds the `.request.body` and `.request.files` to the context.

**Arguments:**

* **opts** - the options that get passed to the [`Formidable.IncomingForm`](https://github.com/felixge/node-formidable#formidableincomingform) (you could also provide an instance of `IncomingForm` directly)

**Example:**

```js
var formidable = require('koa-formidable')
app.use(formidable())
```

### formidable.parse(opts, ctx)

Parse the incoming request manually.

**Arguments:**

* **opts** - the options that get passed to the [`Formidable.IncomingForm`](https://github.com/felixge/node-formidable#formidableincomingform) (you could also provide an instance of `IncomingForm` directly)
* **ctx** - the Koa context

**Example:**

```js
var formidable = require('koa-formidable')
app.use(function*(next) {
  var form = yield formidable.parse(this)
  ...
  yield next
})
```

### Using formidable Events

**Example:**

```js
var form = new require('formidable').IncomingForm()
form.on('progress', function(bytesReceived, bytesExpected) {
      console.log(bytesReceived, bytesExpected)
})
var result = yield formidable.parse(form, this)
```

## License

[MIT](LICENSE)

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