node.jscloud-foundrymultersap-cloud-platformsap-cloud-foundry

Using Multer library in SAP cloud platform(Web IDE)- cloud foundry


im using multer for saving user uploaded files in disk storage.

var storage = multer.diskStorage({
    destination: function (req, file, cb) {
      cb(null, 'files');
    },
    filename: function (req, file, cb) {
      cb(null, Date.now() + '-' +file.originalname );//1534235345345-promis.pdf
    }
  });

const upload=multer({
    storage:storage
});

so when ever service instance is stopped in the SAP cloud cockpit, files saved in disk are automatically deleted when we restart the service instance. Is there any way to store the uploaded files permanently in the disk.


Solution

  • In SAP Cloud Platform there is currently no way to "mount" some persistant disk storage. Everything you store to disk is only temporary and will be reset once you restart your app. This is no different to any other containerized platform. You need to use some persistent storage e.g.