multer
| Property | Value |
|---|---|
| Package | multer |
| Versions Covered | >=2.0.0 <3.0.0 |
| Contract Version | 1.0.0 |
| Status | production |
| Last Verified | 2026-02-26 |
| Maintainer | corpus-team |
Installation
npm install multer
Covered Functions
This contract covers 2 function(s):
single()
Middleware for handling single file upload
Import:
import { single } from 'multer';
Postconditions
What happens after calling this function:
🔴 ERROR - single-throws-multer-error
Condition: file upload fails due to size limit, file type, or disk error
Throws: MulterError
Required Handling:
Caller MUST add error handling middleware after multer to catch MulterError. Check error.code for specific failure reason (LIMIT_FILE_SIZE, LIMIT_UNEXPECTED_FILE, etc.)
📖 Source
Edge Cases
Known gotchas and sharp edges:
⚠️ WARNING - file-size-dos-prevention
Configure limits option to prevent DoS via large file uploads. Unlimited file sizes can exhaust disk space or memory.
📖 Source