Hi,
I'm using multer to read in a file using multi-part form data. However, I don't want to upload the file, but I want to read the file contents into a string. Is there a way to do this?
var storage = multer.memoryStorage();
var upload = multer({
storage: storage
});
router.post('/', upload.single('uploadExcel'), function (req, res) {
var uploadExcel = req.file;
var buffer = uploadExcel.buffer;
return res.status(200).send("Nice!");
});
What @jdnichollsc said. Furthermore, if you really want it to be a string, and not a buffer, you can use the .toString() method on the buffer.
How can I send the file after I got it ? I would like to send from NodeJS to other process which reads multipart data
Most helpful comment