Buckets:
| function forceDownload(blobUrl: string, filename: string) { | |
| let a: any = document.createElement("a"); | |
| a.download = filename; | |
| a.href = blobUrl; | |
| document.body.appendChild(a); | |
| a.click(); | |
| a.remove(); | |
| } | |
| export default function downloadPhoto(url: string, filename: string) { | |
| if (!filename) filename = url.split("\\").pop().split("/").pop(); | |
| fetch(url, { | |
| headers: new Headers({ | |
| Origin: location.origin, | |
| }), | |
| mode: "cors", | |
| }) | |
| .then((response) => response.blob()) | |
| .then((blob) => { | |
| let blobUrl = window.URL.createObjectURL(blob); | |
| forceDownload(blobUrl, filename); | |
| }) | |
| .catch((e) => console.error(e)); | |
| } | |
Xet Storage Details
- Size:
- 657 Bytes
- Xet hash:
- 0cffc0cf7ae39fa7c87993f63349f3b32834b91046453b1e250b21ea2e88e173
·
Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.