I have a route that expects a multipart form and in this multipart form, there are two files that are going to be uploaded.
1- a video file that should have a size limit of 2GB and is going to be directly saved on disk in public/videos
2- a thumbnail which is an image that should have a size limit of 20MB and is going to be saved in memory to be resized with sharp and saved into a different directory which is public/video/thumbnails
I tried to use upload.fields([ { name: 'video', maxCount: 1 }, { name: 'thumbnail', maxCount: 1 } ])
. but it doesn't satisfy. These two files should have different size limits and I want one to be stored in disk directly and the other one in memory.
It looks like I need two different multer().single()
on the same route.
Is it possible with multer to do this? or any other multipart parsers?