云函数代码:
var fs = require(“fs”)
console.log(“准备写入文件”)
fs.writeFileSync(‘input.txt’, ‘我是写入文件的内容333’)
console.log(“准备读出文件”)
var res = fs.readFileSync(‘input.txt’)
console.log("读取文件数据: ", res)
运行返回信息:
2018-11-04T04:30:10.109Z 505cc9c4-dfea-11e8-9a99-52540064d067 准备写入文件
Error: EROFS: read-only file system, open 'input.txt'
at Object.fs.openSync (fs.js:646:18)
at Object.fs.writeFileSync (fs.js:1291:33)
at EventHandler.exports.main [as realHandler] (/var/user/index.js:51:6)
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
请帮忙看看是什么原因?难道云函数不能进行文件操作吗?