| 83 | |
| 84 | |
| 85 | const handleFile = async bytes => { |
| 86 | state = 1; |
| 87 | currentProgress = 80; |
| 88 | |
| 89 | if (file === null) { |
| 90 | file = await decryptFile( |
| 91 | bytes, |
| 92 | key, |
| 93 | iv, |
| 94 | mimeType, |
| 95 | fileName |
| 96 | ); |
| 97 | } |
| 98 | |
| 99 | const url = URL.createObjectURL(file); |
| 100 | |
| 101 | const a = document.createElement('a'); |
| 102 | a.href = url; |
| 103 | a.download = file.name; |
| 104 | a.style.display = 'none'; |
| 105 | a.onclick = () => { |
| 106 | console.log('hi'); |
| 107 | URL.revokeObjectURL(url) |
| 108 | }; |
| 109 | |
| 110 | success(); |
| 111 | |
| 112 | setTimeout(() => { |
| 113 | a.click(); |
| 114 | }, 350); |
| 115 | } |
| 116 | |
| 117 | const base64UrlToArrayBuffer = string => { |
| 118 | const base64String = string.replace(/-/g, '+').replace(/_/g, '/'); |
no test coverage detected