async updateUserInfo(openid, newInfo) {
const {
nickname,
avatar
} = newInfo
const regex = /[^\.]\w*$/
const imageType = avatar.match(regex)[0]
const base64Data = avatar.replace(/^data:image\/\w+;base64,/, "")
let bf = Buffer.from(base64Data, 'base64')
const checkMessageResult = await msgSecCheck(openid, nickname)
const checkImgResult = await imgSecCheck(bf)
if (checkMessageResult.result.suggest === "pass" && checkImgResult.errcode === 0) {
let result = await uniCloud.uploadFile({
cloudPath: `${base64Data.slice(0,8)}.${imageType}`,
fileContent: bf
})
}
}
将bf提交报错
请问base64编码后的图片要怎么转化成buffer对象传入呀