writeFile() {
var fileManager = wx.getFileSystemManager();
//var array = this.str2ab(‘健康长寿’);
fileManager.writeFile({
filePath: `${wx.env.USER_DATA_PATH}/name1.txt`,
encoding: ‘base64’,
data: ‘健康长寿’,
complete(res) {
console.log(res);
var fileManager = wx.getFileSystemManager()
fileManager.appendFile({
filePath: `${wx.env.USER_DATA_PATH}/name1.txt`,
data: ‘乱我心者今日之日多烦忧’,
encoding:‘base64’,
complete(res) {
console.log(res)
fileManager.readFile({
filePath: `${wx.env.USER_DATA_PATH}/name1.txt`,
encoding:‘utf8’,
complete(res) {
console.log(res)
}
})
}
})
}
})
},
如果在writeFile的时候传入utf8就能写入成功,但是base64就失败,到底writeFile是否支持base64呢?
还有如果writeFile encoding 是utf8 appendFile是base64 读取的内容应该是什么呢?