(base64)
| 3395 | return { arrayBuffer: arrayBuffer, base64: pdfbase64 }; |
| 3396 | } |
| 3397 | export function base64ToArrayBuffer(base64) { |
| 3398 | // Decode the base64 string to a binary string |
| 3399 | const binaryString = atob(base64); |
| 3400 | // Create a new ArrayBuffer with the same length as the binary string |
| 3401 | const len = binaryString.length; |
| 3402 | const bytes = new Uint8Array(len); |
| 3403 | // Convert the binary string to a byte array |
| 3404 | for (let i = 0; i < len; i++) { |
| 3405 | bytes[i] = binaryString.charCodeAt(i); |
| 3406 | } |
| 3407 | // Return the ArrayBuffer |
| 3408 | return bytes.buffer; |
| 3409 | } |
| 3410 | export function removeBase64Prefix(base64String) { |
| 3411 | return base64String.replace(/^data:.*;base64,/, ""); |
| 3412 | } |
no outgoing calls
no test coverage detected