expressjs / expressjs/multer

bodySize limit option

Open
#1,363 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
12.1k
Forks
1.1k
Avg merge
8d 2h
Merged PRs (30d)
21

Description

I wish there was an option just like what bodyParser provides which allows you to limit the total body size rather than per field. This way using memory storage isn't at risk of someone filling your entire RAM with bogus data but still gives you the freedom to spread the data unevenly over different fields without hard capping all fields evenly.

An example:
```js
multer({
limits: {
bodySize: Math.pow(1024, 2) * 50
},
storage: memoryStorage()
}).any();
```

Regarding the template question if I want to work on it myself:
I personally don't really have a lot of time to learn the inner workings of this framework to make this feature myself so I'm asking this from others incase anyone is interested in making this idea.

Contributor guide

Open the contributing guide

Research direction

Start by tracing Multer's limits option and memoryStorage path, then compare the requested behavior with bodyParser's total-body limit. Done means a configurable bodySize limit exists without imposing equal per-field caps, including for uneven multipart fields using memory storage.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.