Multer

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

Library
npm
v2.4.0
12,087 stars
MIT License

Repository Health

Pre-computed score based on development activity, maintenance, community, maturity, and trend momentum. How we score it →
85 /100 Excellent
Development Activity 92
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
95%
Apache 2.0

AionUi

AI Agents · Productivity

33,179

Free, open-source Cowork desktop app that unifies Claude Code, Codex, Gemini CLI, and 20+ AI agents into a single platform with multi-agent teams, 24/7 cron automation, and zero-config built-in agent.

View details
85
Repo Health
76
Technical
66
Dependency
Built with
TypeScript 95%
Updated 3 weeks ago
JavaScript
95%
MIT

AnythingLLM

AI Assistants · Automation · Developer Tools

66,533

The all-in-one AI platform for private document chat, no-code agents, and local LLMs with zero setup friction.

View details
90
Repo Health
78
Technical
64
Dependency
Built with
JavaScript 95%
Updated 6 days ago
TypeScript
49%
MPL 2.0

Artillery

Developer Tools · Devops

9,083

Cloud-scale load testing and functional testing for APIs, WebSockets, gRPC, and headless browsers, distributed across AWS Lambda or Fargate with zero infrastructure to manage.

View details
89
Repo Health
73
Technical
68
Dependency
Built with
TypeScript 49%
JavaScript 48%
Updated 1 weeks ago
JavaScript
100%
Other

Automatisch

Automation · No Code Platforms

13,979

Self-hosted, no-code workflow automation that keeps your data on your own servers—a privacy-first alternative to Zapier with 90+ integrations.

View details
49
Repo Health
78
Technical
62
Dependency
Built with
JavaScript 100%
Updated 7 months ago
TypeScript
97%
AGPL 3.0

Bigcapital

Invoicing Finance

3,916

Self-hostable double-entry accounting platform with invoicing, inventory, multi-currency, and real-time financial reporting for small and medium businesses.

View details
90
Repo Health
77
Technical
61
Dependency
Built with
TypeScript 97%
Updated 6 days ago
TypeScript
96%
Other

CapRover

Developer Tools · Devops · Hosting Control Panel

15,173

Deploy any app, database, or website to your own server in minutes—no Docker or Linux expertise required.

View details
87
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 96%
Updated 1 weeks ago
JavaScript
99%
Other

ChartBrew

Analytics · Databases

4,063

Open-source reporting platform to build live dashboards from SQL, NoSQL, APIs, and SaaS tools with an AI assistant that creates charts from natural language.

View details
90
Repo Health
83
Technical
64
Dependency
Built with
JavaScript 99%
Updated 1 weeks ago
TypeScript
98%
AGPL 3.0

Checkmate

Analytics · Devops · Monitoring

10,895

Self-hosted uptime and infrastructure monitoring with multi-protocol checks, global geo-coverage, and beautiful real-time dashboards.

View details
90
Repo Health
82
Technical
67
Dependency
Built with
TypeScript 98%
Updated 1 weeks ago
Java
34%
Apache 2.0

Enso

Analytics · Data Engineering · Low Code Platforms

7,441

A visual and textual programming platform for data prep and analysis where the node graph and the underlying Enso code are always perfectly in sync, built by an Alteryx co-founder on a GraalVM engine.

View details
59
Repo Health
90
Technical
61
Dependency
Built with
Java 34%
TypeScript 27%
Scala 26%
Updated 1 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