Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 7, 2026·3 min de lecture

formidable — Fast Streaming Multipart Form Parser for Node.js

The most widely used multipart form data parser for Node.js, handling file uploads with streaming efficiency.

Prêt pour agents

Installation avec revue préalable

Cet actif nécessite une revue. Le prompt copié demande un dry-run, affiche les écritures, puis continue seulement après confirmation.

Needs Confirmation · 64/100Policy : confirmer
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
formidable Overview
Commande avec revue préalable
npx -y tokrepo@latest install 95efd7f1-799e-11f1-9bc6-00163e2b0d79 --target codex

Dry-run d'abord, confirmez les écritures, puis lancez cette commande.

Introduction

formidable is a streaming multipart form data parser for Node.js. It handles file uploads efficiently by writing incoming data directly to disk or a custom destination as it arrives, rather than buffering entire files in memory. Originally created in 2010 by Felix Geisendorfer, it remains one of the most downloaded file upload parsers in the Node.js ecosystem.

What formidable Does

  • Parses multipart/form-data requests for file uploads
  • Parses application/x-www-form-urlencoded and JSON request bodies
  • Streams uploaded files directly to disk to minimize memory usage
  • Provides progress events for upload monitoring
  • Supports pluggable file storage backends

Architecture Overview

formidable uses a streaming state machine to parse incoming HTTP request bodies. As data chunks arrive, the parser identifies multipart boundaries, extracts headers, and routes file content to writable streams. This architecture means a 1 GB upload never occupies more than a few kilobytes of memory. The parser emits events for each field, file start, file end, and progress update. A plugin system allows replacing the default file writer with custom backends like cloud storage.

Self-Hosting & Configuration

  • Install via npm: npm install formidable
  • Set upload directory: formidable({ uploadDir: '/tmp/uploads' })
  • Limit file size: formidable({ maxFileSize: 10 * 1024 * 1024 }) for 10 MB
  • Allow multiple files per field: formidable({ multiples: true })
  • Use with Express: wrap in middleware or call form.parse(req) inside a route handler

Key Features

  • Streaming parser with minimal memory footprint even for large uploads
  • Built-in support for multipart, urlencoded, and JSON content types
  • File size and field count limits to prevent abuse
  • Upload progress events for building progress bars
  • Pluggable file handling for custom storage destinations

Comparison with Similar Tools

  • multer — Express-specific middleware; formidable works with any Node.js HTTP server
  • busboy — lower-level streaming parser; formidable adds file management and a higher-level API
  • multiparty — similar streaming approach; formidable has broader adoption and active maintenance
  • express-fileupload — simpler API but buffers files in memory; formidable streams to disk by default

FAQ

Q: Does formidable work with Express? A: Yes. Call form.parse(req) inside an Express route handler. It does not require Express-specific middleware.

Q: How do I limit upload file size? A: Set maxFileSize in the options: formidable({ maxFileSize: 5 * 1024 * 1024 }) for a 5 MB limit.

Q: Can I upload files to cloud storage instead of disk? A: Yes. Use the plugin system or handle the fileBegin event to pipe file data to a cloud storage SDK stream.

Q: Does it support multiple file uploads in a single field? A: Yes. Enable with formidable({ multiples: true }). Files arrive as an array in the parsed result.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires