Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on Feb 29, 2024 via pnpm

formidable 2.1.0

A node.js module for parsing form data, especially file uploads.
Package summary
Share
0
issues
3
licenses
17
MIT
3
ISC
1
BSD-3-Clause
Package created
18 Jan 2011
Version published
1 Dec 2022
Maintainers
5
Total deps
21
Direct deps
4
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
17 Packages, Including:
asap@2.0.6
call-bind@1.0.7
define-data-property@1.1.4
es-define-property@1.0.0
es-errors@1.3.0
formidable@2.1.0
function-bind@1.1.2
get-intrinsic@1.2.4
gopd@1.0.1
has-property-descriptors@1.0.2
has-proto@1.0.3
has-symbols@1.0.3
hasown@2.0.1
hexoid@1.0.0
object-inspect@1.13.1
set-function-length@1.2.1
side-channel@1.0.5

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
3 Packages, Including:
dezalgo@1.0.4
once@1.4.0
wrappy@1.0.2

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
qs@6.11.2
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

4
All Dependencies CSV
β“˜ This is a list of formidable 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
dezalgo1.0.41.65 kBISC
prod
hexoid1.0.03.46 kBMIT
prod
once1.4.01.93 kBISC
prod
qs6.11.252 kBBSD-3-Clause
prod

Visualizations

Frequently Asked Questions

What does formidable do?

Formidable is a Node.js module that specializes in parsing form data, particularly file uploads. This versatile package offers a fast(around 900-2500 mb/sec) and streaming multipart parser that automatically writes file uploads to disk, gives you the option to utilize a Plugins API for custom parsers, maintains a low-memory footprint, and provides very high test coverage.

How do you use formidable?

Using Formidable in your project involves installing it as a dependency through npm and calling its functions in your code. To install the package, navigate to your project root and run npm install formidable. Here are examples of how to use Formidable with Node.js http module, Express.js, and Koa :

With Node.js http module:

import http from 'node:http';
import formidable, {errors as formidableErrors} from 'formidable';

const server = http.createServer(async (req, res) => {
  if (req.url === '/api/upload' && req.method.toLowerCase() === 'post') {
    const form = formidable({});
    let fields;
    let files;
    try {
        [fields, files] = await form.parse(req);
    } catch (err) {
        console.error(err);
        res.writeHead(err.httpCode || 400, { 'Content-Type': 'text/plain' });
        res.end(String(err));
        return;
    }
    res.writeHead(200, { 'Content-Type': 'application/json' });
    res.end(JSON.stringify({ fields, files }, null, 2));
    return;
  }
  res.writeHead(200, { 'Content-Type': 'text/html' });
  res.end('Upload form');
});

server.listen(8080, () => {
  console.log('Server listening on http://localhost:8080/ ...');
});

With Express.js:

import express from 'express';
import formidable from 'formidable';

const app = express();

app.get('/', (req, res) => {
  res.send('Upload form');
});

app.post('/api/upload', (req, res, next) => {
  const form = formidable({});
  form.parse(req, (err, fields, files) => {
    if (err) {
      next(err);
      return;
    }
    res.json({ fields, files });
  });
});

app.listen(3000, () => {
  console.log('Server listening on http://localhost:3000 ...');
});

With Koa:

import Koa from 'koa';
import formidable from 'formidable';

const app = new Koa();

app.use(async (ctx, next) => {
  if (ctx.url === '/api/upload' && ctx.method.toLowerCase() === 'post') {
    const form = formidable({});
    await new Promise((resolve, reject) => {
      form.parse(ctx.req, (err, fields, files) => {
        if (err) {
          reject(err);
          return;
        }
        ctx.body = { fields, files };
        resolve();
      });
    });
    await next();
    return;
  }
  ctx.body = 'Upload form';
});

app.listen(3000, () => {
  console.log('Server listening on http://localhost:3000 ...');
});

Where are the formidable docs?

Formidable's documentation including detailed API guides, examples, and more, can be found on the official GitHub repository. Here, you can check out usage instructions, learn about the different options and functions provided by the module, and view practical examples of code implementation.