Reputation: 2887
I've pushed some node application to CF and I want to access to the file system inside the application container ,I didn't found lot of docs about the application container (warden) file system and how should I access it from inside the application,in node js typically you should use the fs module...
Upvotes: 0
Views: 885
Reputation: 3546
You can use the file system to get to your application files the same way you would when running the application locally. You can use fs.
The file you want to read should be packaged with your application. If "foo.txt" is at the root of your application :
fs.readFile("foo.txt", "utf8", function(error, data) {
console.log(data);
});
Here is an example of using fs in a cloud foundry environment: http://www.ibm.com/developerworks/cloud/library/cl-bluemix-nodejs-app/
Keep in mind, it is not a good idea to write data to the file system as it is ephemeral, and not shared across instances. Use a database service such as Mongo to save your data.
Upvotes: 2