Multer

Streamlined multipart/form-data file upload handling for Express and Node.js APIs.

Library
npm
v2.5.0
12,088 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
86 /100 Excellent
Development Activity 96
Maintenance 72
Community 76
Maturity 60
Momentum 40

Technical Analysis

AI-assessed by reading the actual repository — architecture, code quality, innovation, and documentation. How we score it →
82 /100 Excellent
Architecture 78
Code Quality 84
Innovation 80
Learning Curve 85

Multer is the de facto standard middleware for handling multipart/form-data in Node.js, most commonly used to accept file uploads in Express applications. Built on top of busboy for streaming performance, it parses incoming multipart requests and attaches parsed text fields to req.body and uploaded files to req.file or req.files, with pluggable storage engines for writing to disk or buffering in memory.

With over 12,000 GitHub stars and tens of millions of weekly npm downloads, Multer has become the default choice any time a Node.js backend needs to accept uploaded files — profile pictures, documents, CSV imports, or attachments — without hand-rolling a multipart parser.

What You Get

  • Drop-in Express/Connect middleware for parsing multipart/form-data requests
  • Built-in DiskStorage and MemoryStorage engines, plus a documented StorageEngine interface for custom storage (S3, GCS, databases)
  • Field-level upload strategies via .single(), .array(), .fields(), .any(), and .none()
  • Configurable limits (file size, file count, field count, part count) to guard against DoS uploads
  • Typed MulterError codes for granular error handling

Common Use Cases

  • Accepting profile picture or avatar uploads in a REST API
  • Handling document/CSV/PDF attachment uploads alongside form text fields
  • Building admin dashboards or CMS backends that accept bulk file uploads
  • Streaming uploaded files directly into custom storage backends (S3-compatible object storage) via a custom StorageEngine

Under The Hood

Architecture: Multer’s architecture centers on a factory pattern: the exported multer() function (index.js) constructs a Multer instance holding shared config (storage engine, limits, fileFilter), and instance methods like .single(), .array(), .fields(), .none(), .any() each call _makeMiddleware() to produce an Express-compatible (req, res, next) handler via lib/make-middleware.js. That core middleware wires a busboy parser to the request stream, using a Counter (lib/counter.js, an EventEmitter-based pending-writes counter) to track in-flight file writes and a FileAppender (lib/file-appender.js) that abstracts the three request-shape strategies (VALUE/ARRAY/OBJECT/NONE) for attaching parsed files to req.file/req.files. Storage is delegated to a pluggable StorageEngine interface (storage/disk.js, storage/memory.js) implementing _handleFile/_removeFile, and any failed or aborted upload triggers remove-uploaded-files.js to clean up partially-written files before calling next(err) with a MulterError.

Tech Stack: The library is plain CommonJS JavaScript (no build step, no TypeScript — 100% JS per GitHub language stats) targeting Node >= 10.16.0. Runtime dependencies are minimal and purpose-built: busboy (the actual multipart stream parser Multer wraps), type-is (content-type sniffing to short-circuit non-multipart requests), append-field (nested/bracket-notation form field parsing), and concat-stream. Dev tooling uses standard for linting/formatting (no ESLint/Prettier config), mocha + nyc for tests and coverage, and express/form-data/fs-temp/testdata-w3c-json-form as test fixtures. CI (.github/workflows/ci.yml) runs the full mocha suite across 17 Node.js versions (10.x through 26.x), reflecting a strong backward-compatibility commitment for an Express-ecosystem package.

Code Quality: Test coverage is substantial: 19 spec files under test/ totaling ~2,484 lines covering disk/memory storage, field/file limits, error handling, Express integration, Unicode filenames, nesting depth, and orphaned-file cleanup — run via mocha --check-leaks with nyc coverage reporting to Coveralls in CI. Code style is consistent (var-based ES5-leaning style enforced by standard), functions are small and single-purpose, and error paths are explicit via a dedicated MulterError type with a fixed errorMessages map (lib/multer-error.js) rather than generic thrown errors. Edge-case handling is notably careful — make-middleware.js guards against double-invoking next(), drains the request stream on error to avoid EPIPE, and listens for aborted/close to avoid hangs on client disconnects — the kind of defensive stream handling expected of infrastructure-grade middleware maintained by the Express org.

API Design: Multer’s public API is deliberately narrow and mirrors Express’s own middleware conventions, minimizing the learning curve: multer(opts).single/array/fields/any/none() returns a standard (req, res, next) middleware with no unusual invocation pattern. The dest shorthand covers the common case in one line, while storage unlocks full control via a documented (StorageEngine.md) three-function interface (_handleFile, _removeFile, plus a constructor) that third-party packages (multer-s3, multer-gridfs-storage, etc.) implement. Trade-offs: there’s no bundled TypeScript definitions (community-maintained via @types/multer on DefinitelyTyped), and file objects are loosely-typed plain objects assembled by string-keyed Object.defineProperty/spread rather than a class, which keeps things flexible but offers no compile-time safety without external types.

Used by 44 apps in this directory

TypeScript
96%
Apache 2.0

OneUptime

Monitoring

7,751

The complete open-source observability platform that replaces PagerDuty, Datadog, Sentry, and StatusPage with a single self-hostable system.

View details
91
Repo Health
81
Technical
65
Dependency
Built with
TypeScript 96%
Updated 5 days ago
TypeScript
72%
Apache 2.0

open-design

Design Tools

103,625

Local-first, open-source Claude Design alternative that turns your existing coding agent CLI into a full agentic design studio — with 259+ skills, 142+ design systems, and sandboxed artifact delivery across web, desktop, and mobile surfaces.

View details
85
Repo Health
86
Technical
72
Dependency
Built with
TypeScript 72%
HTML 21%
Updated 5 days ago
JavaScript
90%
Other

OpenSign

Digital Signiture

7,163

Self-host a full-featured DocuSign alternative with unlimited e-signatures, multi-signer workflows, and cryptographic PDF signing.

View details
83
Repo Health
61
Technical
69
Dependency
Built with
JavaScript 90%
Updated 6 days ago
Vue
41%
AGPL 3.0

Operational

Analytics · Automation · Monitoring

474

Open-source event tracker with real-time push notifications and action buttons for tech founders.

View details
54
Repo Health
68
Technical
68
Dependency
Built with
Vue 41%
JavaScript 39%
MDX 13%
Updated 3 weeks ago
JavaScript
64%
AGPL 3.0

overleaf

Collaboration · Productivity

18,266

Open-source, real-time collaborative LaTeX editor with sandboxed compilation and full TeXLive support for self-hosted academic and research teams.

View details
84
Repo Health
80
Technical
59
Dependency
Built with
JavaScript 64%
TypeScript 30%
Updated 1 months ago
TypeScript
93%
MIT

paperclip

AI Agents · Automation

106,667

The open-source control plane that turns a pile of AI agents into an actual company — with org charts, budgets, heartbeats, and governance.

View details
86
Repo Health
78
Technical
68
Dependency
Built with
TypeScript 93%
Updated 5 days ago
TypeScript
91%
AGPL 3.0

PeerTube

Social Media

15,362

A federated, ActivityPub-based video hosting platform built by Framasoft — self-hostable instances interconnect into a network with no vendor lock-in, P2P-assisted streaming, and no ads.

View details
96
Repo Health
75
Technical
66
Dependency
Built with
TypeScript 91%
Updated 1 weeks ago
TypeScript
81%
AGPL 3.0

Postiz

Automation · Social Media

37,683

The agentic social media scheduler — AI-powered content creation, 33-platform posting, and team workflows, all self-hosted.

View details
92
Repo Health
70
Technical
63
Dependency
Built with
TypeScript 81%
JavaScript 11%
Updated 6 days ago
JavaScript
50%
AGPL 3.0

QRev

AI Agents · CRM

364

Open source AI-first sales platform that replaces Salesforce with autonomous agents handling prospecting, outreach, and lead management at scale.

View details
39
Repo Health
68
Technical
64
Dependency
Built with
JavaScript 50%
Python 28%
TypeScript 14%
Updated 8 months ago

Join founders buildingwith open source

Opinionated takes, migration guides, cost-saving tips, and insights from the open source ecosystem.

Subscribe on Substack
Join 750+ subscribers