微信小程序支持blob文件吗
发布于 5 年前 作者 jie99 3260 次浏览 来自 问答

dataURLToFile:function(dataurl, filename) {

let arr = dataurl.split(’,’);

console.log(arr[0]);

let mime = arr[0].match(/:(.*?);/)[1],

bstr = atob(arr[1]),

n = bstr.length,

u8arr = new Uint8Array(n);

while (n–) {

u8arr[n] = bstr.charCodeAt(n);

}

return new File([u8arr], filename, { type: mime });

},

这个是base转为blob文件对象,但是运行的时候File报错

File is not defined;at pages/singature/singature page dataURLToFile function

ReferenceError: File is not defined

有没有大佬可以告知,是为什么啊?微信小程序支持blob文件对象吗?

3 回复

目前暂不支持此功能。

希望可以支持一下

暂时不支持,你可以发需求帖 提出具体的需求和使用场景 官方会评估

回到顶部