| 123456789101112 |
- //base64转Blob
- export function base64ToBlob(base64, type) {
- console.log(base64);
- const bstr = atob(base64.replace(/^[^,]+,/, ''))
- let n = bstr.length
- const u8arr = new Uint8Array(n)
- while (n--) {
- u8arr[n] = bstr.charCodeAt(n)
- }
- // return new Blob([u8arr], { type: type || '' })
- return new Blob([u8arr], { type: type || 'image/jpeg' })
- }
|