微信小程序支持blob文件吗

发布于 7 年前作者 jie993415 次浏览最后编辑 7 年前来自 ask

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 回复
yyao
yyao1 楼6 年前

目前暂不支持此功能。

cxiong
cxiong2 楼6 年前

希望可以支持一下

na03
na033 楼5 年前

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