(dataURI: string)
| 391 | */ |
| 392 | |
| 393 | export function base64ToBlob(dataURI: string) { |
| 394 | const mimeString = dataURI.split(",")[0].split(":")[1].split(";")[0]; |
| 395 | const byteString = atob(dataURI.split(",")[1]); |
| 396 | const arrayBuffer = new ArrayBuffer(byteString.length); |
| 397 | const intArray = new Uint8Array(arrayBuffer); |
| 398 | |
| 399 | for (let i = 0; i < byteString.length; i += 1) { |
| 400 | intArray[i] = byteString.charCodeAt(i); |
| 401 | } |
| 402 | return new Blob([intArray], { type: mimeString }); |
| 403 | } |
| 404 | |
| 405 | export function strToBase64(str: string): string { |
| 406 | return btoa( |
no outgoing calls
no test coverage detected