I use the Multer module to upload files. Although everything is working fine, a warning appears at the end of their github page saying: "WARNING: req.body is fully analyzed after the file upload is complete. Accessing req.body can lead to errors prematurely."
It bothered me a lot. I just can't find a way to notify .post middleware when files are uploaded and req.body is ready to use. Here is my code:
app.js:
app.use(multer({ dest: './uploads/', rename: function (fieldname, filename) { return filename.replace(/\W+/g, '-').toLowerCase() + Date.now(); }, putSingleFilesInArray: true }) );
upload.js:
router.route('/') .get(function(req, res){ res.render('uploads'); }) .post(function(req, res){
So far I know onParseEnd, but I donβt know how to implement it, so I have at least some information about the completion of the download process.
source share