// 转 file
dataURIToFile(dataURI) {
let binStr = atob(dataURI.split(',')[1])
let len = binStr.length
let arr = new Uint8Array(len)
for (var i = 0; i < len; i++) {
arr[i] = binStr.charCodeAt(i);
}
return new File([arr], `xx.pdf`, {
type: 'application/pdf',
lastModified: new Date()
})
}
// 转 blob
dataURIToBolb(dataURI) {
let binStr = atob(dataURI.split(',')[1])
let len = binStr.length
let arr = new Uint8Array(len)
for (var i = 0; i < len; i++) {
arr[i] = binStr.charCodeAt(i);
}
return new Blob([arr], {
type: 'application/pdf',
})
}