koa-formidable
Formidable middleware for Koa
![NPM][npm] ![Dependency Status][dependencies]
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
(you could also provide an instance ofIncomingForm
directly)
Example:
var formidable = app
formidable.parse(opts, ctx)
Parse the incoming request manually.
Arguments:
- opts - the options that get passed to the
Formidable.IncomingForm
(you could also provide an instance ofIncomingForm
directly) - ctx - the Koa context
Example:
var formidable = app
Using formidable Events
Example:
var form = 'formidable'formvar result = formidable