I'm trying to save a file to a specific location on the server disk (using multer
), but this location name is related to data i receive in request along with file.
I came to conclusion that I can save file in memory, and later (after some other part of code will complete, and i will have my location name generated) I will save that file to disk space. And this is where i stuck - how can I save file in node.js from object in memory to specific disk location?
This is object that i have saved in memory:
{ fieldname: 'file',
originalname: '20190221_171825.jpg',
encoding: '7bit',
mimetype: 'image/jpeg',
buffer:
<Buffer ff d8 ff e1 ... >,
size: 5173060 }