File read/write on cloud(heroku) using node.js

◇◆丶佛笑我妖孽 提交于 2020-07-15 09:40:11

问题


First of all I am a beginner with node.js. In node.js when I use functions such as fs.writeFile(); the file is created and is visible in my repository. But when this same process is done on a cloud such as heroku no file is visible in the repository(cloned via git). I know the file is being made because I am able to read it but I cannot view it. Why is this??? Plus how can I view the file?


回答1:


I had the same issue, and found out that Heroku and other cloud services generally prefer that you don't write in their file system; everything you write/save will be store in "ephemeral filesystem", it's like a ghost file system really.

Usually you would want to use Amazon S3 or reddis for json files etc, and other bigger ones like mp3.

I think it will work if you rent a remote server, like ECS, with a linux system, and a mounted storage space, then this might work.



来源:https://stackoverflow.com/questions/41014688/file-read-write-on-cloudheroku-using-node-js

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!