You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
12 lines
385 B
12 lines
385 B
12 months ago
|
export function base64ToBlob(code) {
|
||
|
let parts = code.split(';base64,')
|
||
|
let contentType = parts[0].split(':')[1]
|
||
|
let raw = window.atob(parts[1])
|
||
|
let rawLength = raw.length
|
||
|
let uInt8Array = new Uint8Array(rawLength)
|
||
|
for (let i = 0; i < rawLength; ++i) {
|
||
|
uInt8Array[i] = raw.charCodeAt(i)
|
||
|
}
|
||
|
return new Blob([uInt8Array], { type: contentType })
|
||
|
}
|