Packages

multer

2.5.0 · 22 Oct 2026MIT30.7M / weekRepositoryHomepagenpmAtom feed

Your version

2.4.0

14 Sep 2026Where it was published

2.5.0 is the newest release of 2.x.

In short

1 security5 new9 fixed1 changed10 internal

Security

Fixes 1 advisory that affected 2.3.0

1 advisory affects 2.4.0; 2.5.0 fixes them

Release note

Highlights

multer finally supports Google Cloud Functions and Firebase 🎉

These platforms read the request body before your code runs, so multer's classic req.pipe(busboy) received nothing: empty req.body, empty req.files, and nearly a decade of duplicated issues.

The new streamHandler option closes that gap: you decide how the body reaches the parser, so the pre-read rawBody just works (see image).

const multer = require('multer')

const upload = multer({
  storage: multer.memoryStorage(),
  streamHandler: (req, busboy) => {
    // Cloud Functions / Firebase expose the pre-read body here
    if (req.rawBody) busboy.end(req.rawBody)
    else req.pipe(busboy)
  }
})

app.post('/upload', upload.single('file'), (req, res) => {
  res.json({ name: req.file.originalname, size: req.file.size })
})

This landed thanks to community PRs going back to 2017; their authors are credited as co-authors in the release.

Important: Security

What's Changed

  • Feat. improve wording for LIMIT_UNEXPECTED_FILE error code

  • Add filename to file errors

  • Reject non-integer fileSize limits

  • Allow exactly limits.parts parts

  • Do not consume maxCount for files skipped by fileFilter

  • Validate all limits at construction time

  • Accept a function for limits

  • Add flush option to disk storage to fsync files before completion

  • Expose busboy defCharset, highWaterMark and fileHwm options

  • Wait for the flush descriptor before unlinking on aborted uploads

  • Reserve the maxCount slot before yielding to an async fileFilter

  • Add streamHandler option to feed busboy from pre-consumed bodies

  • Decode escaped field names, not just filenames

  • Report the decoded filename on LIMIT_FILE_SIZE

  • Allow diskStorage without options