Spaces:
Configuration error
Configuration error
Download frontend/src/utils/download-json.ts from flyingdarkdev/README: direct link, hf CLI and curl.
- Browser
- Download file 410 Bytes
-
https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/utils/download-json.ts
- Command line
-
hf download hf://spaces/flyingdarkdev/README/frontend/src/utils/download-json.ts
-
curl -L -o download-json.ts https://huggingface.co/spaces/flyingdarkdev/README/resolve/main/frontend/src/utils/download-json.ts
410 Bytes
| export const downloadJSON = (data: object, filename: string) => { | |
| const blob = new Blob([JSON.stringify(data, null, 2)], { | |
| type: "application/json", | |
| }); | |
| const url = URL.createObjectURL(blob); | |
| const link = document.createElement("a"); | |
| link.href = url; | |
| link.download = filename; | |
| document.body.appendChild(link); | |
| link.click(); | |
| document.body.removeChild(link); | |
| URL.revokeObjectURL(url); | |
| }; | |