Function
$downloadFileInBrowser
(content: any, fileName: string)
Source from the content-addressed store, hash-verified
| 173 | * @param fileName The name of the file to be downloaded |
| 174 | */ |
| 175 | const $downloadFileInBrowser = (content: any, fileName: string) => { |
| 176 | var hiddenElement = document.createElement('a'); |
| 177 | hiddenElement.href = 'data:text/json;charset=utf-8,' + encodeURIComponent(JSON.stringify(content)); |
| 178 | hiddenElement.target = '_blank'; |
| 179 | hiddenElement.download = fileName; |
| 180 | hiddenElement.click(); |
| 181 | } |
| 182 | |
| 183 | |
| 184 | export { |
Tested by
no test coverage detected