Gathering detailed insights and metrics for express-formidable
Gathering detailed insights and metrics for express-formidable
Gathering detailed insights and metrics for express-formidable
Gathering detailed insights and metrics for express-formidable
npm install express-formidable
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
132 Stars
29 Commits
22 Forks
3 Watching
7 Branches
4 Contributors
Updated on 15 Jul 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-8.1%
7,297
Compared to previous day
Last week
-4%
40,014
Compared to previous week
Last month
8.3%
177,907
Compared to previous month
Last year
12.9%
2,014,171
Compared to previous year
1
An Express middleware of Formidable that just works.
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.
npm install express-formidable
1const express = require('express'); 2const formidableMiddleware = require('express-formidable'); 3 4var app = express(); 5 6app.use(formidableMiddleware()); 7 8app.post('/upload', (req, res) => { 9 req.fields; // contains non-file fields 10 req.files; // contains files 11});
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
.
1app.use(formidableMiddleware(opts));
opts
are options which can be set to form
in Formidable. For example:
1app.use(formidableMiddleware({
2 encoding: 'utf-8',
3 uploadDir: '/my/dir',
4 multiples: true, // req.files to be arrays of files
5});
For the detail, please refer to the Formidable API.
1app.use(formidableMiddleware(opts, events));
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:
1const events = [ 2 { 3 event: 'fileBegin', 4 action: function (req, res, next, name, file) { /* your callback */ } 5 }, 6 { 7 event: 'field', 8 action: function (req, res, next, name, value) { /* your callback */ } 9 } 10];
Unless an error
event are provided by the events
array parameter, it will handle by the standard next(error)
.
git clone https://github.com/utatti/express-formidable.git
cd express-formidable
npm install
To lint and test:
npm test
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
Found 3/28 approved changesets -- score normalized to 1
Reason
project is archived
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
75 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More