wxacode.getUnlimited返回值处理问题?
从接口中返回的数据如下:
request.getWxMiniCode("a=1", function (res) {
console.log(res.data)
const filePath = wx.env.USER_DATA_PATH + '/miniprogram_code.jpeg'
console.log(filePath)
const fs = wx.getFileSystemManager()
const buffer = res.data
fs.writeFile({
filePath: filePath,
data: buffer,
encoding: 'base64',
fail(e) {
console.log("保存失败:" + e)
},
success(e) {
console.log("保存成功:")
console.log(e)
wx.getImageInfo({
src: filePath,
fail(e) {
console.log(e)
},
success: function (res) {
console.log(res)
resolve(res);
},
})
}
})
})
输出信息:
可以看到保存文件成功了,但是读取图片信息失败,请问该接口获取到的数据该如何处理
我现在处理的情况是:
....
const fs = wx.getFileSystemManager()
const buffer = res.data
fs.writeFile({
filePath: filePath,
data: buffer,
encoding: 'base64',
fail(e) {
console.log("保存失败:" + e)
},
....