JSPM

express-formidable

1.0.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 53473
  • Score
    100M100P100Q159218F
  • License MIT

An Express middleware of Formidable that just works.

Package Exports

  • express-formidable

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (express-formidable) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

express-formidable Build Status

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 = require('express');
const formidable = require('express-formidable');

var app = express();

app.use(formidable());

app.post('/upload', (req, res) => {
  req.fields; // contains non-file fields
  req.files; // contains files
});

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.use(formidable(opts));

opts are options which can be set to form in Formidable. For example:

app.use(formidable({
  encoding: 'utf-8',
  uploadDir: '/my/dir',
  multiples: true, // req.files to be arrays of files
});

For the detail, please refer to the Formidable API.

Contribute

git clone https://github.com/noraesae/express-formidable.git
cd express-formidable
npm install

To lint and test:

npm test

License

MIT