-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Description
Multer throws "File too large" error if file size of exat "limits.fileSize" bytes provided. It is non-intuitive behavior. (Or it might be a corner-case.)
It seems that busboy emits event "limit" when limits.fileSize bytes is hit. However, this means that busboy will not further process files, and it might be truncated.
Lines 153 to 156 in 2e07e77
| fileStream.on('limit', function () { | |
| aborting = true | |
| abortWithCode('LIMIT_FILE_SIZE', fieldname) | |
| }) |
Relevant lines in busboy: https://github.com/mscdex/busboy/blob/6b3dcf69d38c1a8d53a0b3e4c88ba296f6c91525/lib/types/multipart.js#L476-L482
Current Workaround
increase limits.fileSize by 1.
Environment information
Version:
To find the installed version of a package, you can check the package.json file in the root directory of your project. The version will be listed under dependencies or devDependencies, like this:
"dependencies": {
// ...
"express": "^5.1.0",
"multer": "^2.0.2",
// ...
}Platform:
Linux NX-281041 6.6.87.2-microsoft-standard-WSL2 #1 SMP PREEMPT_DYNAMIC Thu Jun 5 18:30:46 UTC 2025 x86_64 x86_64 x86_64 GNU/Linux
Node.js version:
v22.16.0