(url, autosign)
| 781 | }; |
| 782 | //convert url to base64 |
| 783 | export async function getBase64FromUrl(url, autosign) { |
| 784 | const data = await fetch(url); |
| 785 | const blob = await data.blob(); |
| 786 | return new Promise((resolve) => { |
| 787 | const reader = new FileReader(); |
| 788 | reader.readAsDataURL(blob); |
| 789 | reader.onloadend = function () { |
| 790 | const pdfBase = this.result; |
| 791 | if (autosign) { |
| 792 | resolve(pdfBase); |
| 793 | } else { |
| 794 | const suffixbase64 = pdfBase.split(",").pop(); |
| 795 | resolve(suffixbase64); |
| 796 | } |
| 797 | }; |
| 798 | }); |
| 799 | } |
| 800 | |
| 801 | export async function getBase64FromIMG(url) { |
| 802 | const data = await fetch(url); |
no outgoing calls
no test coverage detected