(content, filename, mimeType)
| 130 | } |
| 131 | |
| 132 | export function downloadFile(content, filename, mimeType) { |
| 133 | const bom = mimeType === 'text/csv' ? '\uFEFF' : ''; |
| 134 | const blob = new Blob([bom + content], { type: mimeType + ';charset=utf-8' }); |
| 135 | const url = URL.createObjectURL(blob); |
| 136 | |
| 137 | const a = document.createElement('a'); |
| 138 | a.href = url; |
| 139 | a.download = filename; |
| 140 | a.style.display = 'none'; |
| 141 | document.body.appendChild(a); |
| 142 | a.click(); |
| 143 | |
| 144 | setTimeout(() => { |
| 145 | document.body.removeChild(a); |
| 146 | URL.revokeObjectURL(url); |
| 147 | }, 100); |
| 148 | } |
no outgoing calls
no test coverage detected