An Express middleware of Formidable that just works.
What are Express, Formidable, and this?
Express is a fast, unopinionated, minimalist web framework for Node.js.
Formidable is a Node.js module
for parsing form data, including multipart/form-data
file upload.
So, express-formidable
is something like a bridge between them,
specifically an Express middleware implementation of Formidable.
It aims to just work.
Install
npm install express-formidable
How to use
const express = ;const formidableMiddleware = ; var app = ; app; app;
And that's it.
express-formidable can basically parse form types Formidable can handle,
including application/x-www-form-urlencoded
, application/json
, and
multipart/form-data
.
Option
app;
opts
are options which can be set to form
in Formidable. For example:
app
For the detail, please refer to the Formidable API.
Events
app;
events
is an array of json with two field:
Field | Description |
---|---|
event |
The event emitted by the form of formidable. A complete list of all the possible events, please refer to the Formidable Events |
action |
The callback to execute. The signature is function (req, res, next, ...formidable_parameters) |
For example:
const events = event: 'fileBegin' { /* your callback */ } event: 'field' { /* your callback */ } ;
Error event
Unless an error
event are provided by the events
array parameter, it will handle by the standard next(error)
.
Contribute
git clone https://github.com/noraesae/express-formidable.git
cd express-formidable
npm install
To lint and test:
npm test