小程序引入heic2any报错ReferenceError: Blob is not defined

将heic格式的图片转换成jpg发送给后端,安装heic2any之后报错ReferenceError: Blob is not defined,哪位大神遇到过求解?
步骤:
1 npm i heic2any
2 import heic2any from 'heic2any'
3

heic2any({
                blob: 文件路径,
                toType: "image/jpg",
            })
            .then((blob) => {
                console.log('转换结果',blob)
                const fileReader = new FileReader()
                const url = fileReader.readAsDataURL()
                console.log('url====', url)
            })
            .catch((e) => {
                // see error handling section
                console.log('some error',e)
            })
阅读 6.6k
1 个回答

小程序里没有 Blob 类型。

传给后端让后端转码吧。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题