(text, filename, button)
| 438 | |
| 439 | // Function to download the text as a file |
| 440 | const downloadFile = (text, filename, button) => { |
| 441 | const blob = new Blob([text], { type: getMimeType(filename) }) |
| 442 | const url = URL.createObjectURL(blob) |
| 443 | const a = document.createElement('a') |
| 444 | a.href = url |
| 445 | a.download = filename |
| 446 | document.body.appendChild(a) |
| 447 | a.click() |
| 448 | document.body.removeChild(a) |
| 449 | URL.revokeObjectURL(url) |
| 450 | setButtonState(button, 'working', 'download') |
| 451 | } |
| 452 | |
| 453 | // Function to copy text to the clipboard |
| 454 | const copyToClipboard = (text, button) => { |
no test coverage detected