Skip to Content
0
Aug 04, 2020 at 05:21 AM

creating files using node.js in cloud foundry

109 Views

Hi,

im using multer to upload file to the disk.

the problem here is whenever service instance in cockpit is stopped or restarted, all the files gets wiped.

const upload2=multer({});router.post('/uploadfile',upload2.single('file'),(req,res)=>{
let name=req.file.originalname;
let buffer=req.file.buffer; 
fs.writeFile(name, buffer, function (err) { 
if (err) { return res.send(err); } 
console.log(buffer); 
console.log(name); 
res.send(name); });
});

is there any way to store these files pertinently.

regards.

pratheek.