Out of curiosity: Is it okay to share a single Multer instance between several routes to save duplicated setup code? Something like:
import * as multer from 'multer';
const multerInstance = multer({
fileFilter: myFilter,
limits: {
fileSize: 1024 * 1024
}
}).single('file');
app.post('/route1', multerInstance, handler1);
app.post('/route2', multerInstance, handler2);
app.post('/route3', multerInstance, handler3);
Or would this bring any side-effects and I should create separate instances instead?
@qqilihq Creating multerInstance object once and re-using it as middleware function to different routes/clients doesn't affect in my opinion because,
@HarshithaKP Thanks, that sounds very reasonable!
Most helpful comment
@qqilihq Creating multerInstance object once and re-using it as middleware function to different routes/clients doesn't affect in my opinion because,
of each other (Ex: busboy, ..)