MCPcopy Create free account
hub / github.com/javascriptdata/danfojs / $downloadFileInBrowser

Function $downloadFileInBrowser

src/danfojs-base/io/browser/io.json.ts:175–181  ·  view source on GitHub ↗
(content: any, fileName: string)

Source from the content-addressed store, hash-verified

173 * @param fileName The name of the file to be downloaded
174 */
175const $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
184export {

Callers 1

$toJSONFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected