diff options
Diffstat (limited to 'webAO/services/downloadFile.ts')
| -rw-r--r-- | webAO/services/downloadFile.ts | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/webAO/services/downloadFile.ts b/webAO/services/downloadFile.ts new file mode 100644 index 0000000..3774e9b --- /dev/null +++ b/webAO/services/downloadFile.ts @@ -0,0 +1,10 @@ +const downloadFile = (content: string, filename: string) => { + + const a = document.createElement('a'); + const file = new Blob([content], {type: 'text'}); + + a.href= URL.createObjectURL(file); + a.download = filename; + a.click(); +} +export default downloadFile
\ No newline at end of file |
