express-form-data
Module to parse multipart/form data. Based on connect-multiparty
Install
npm install express-form-data
Example
const formData = require("express-form-data");
const express = require("express");
const os = require("os");
const app = express();
const options = {
uploadDir: os.tmpdir(),
autoClean: true
};
app.use(formData.parse(options));
app.use(formData.format());
app.use(formData.stream());
app.use(formData.union());
After this we can see in req:
- req.files = {...} all files
- req.body = {...} all data including files (or streams if you use .stream())