PageSourceSearch

https://visitsuduroy.fo/views/main/js/utils/download.js

js visitsuduroy.fo collected 2026-09-25 09:28:33 UTC 569 bytes, 19 lines download raw bytes

1export function downloadFile(e, url) {
2  e.preventDefault();
3
4  // Get file name from url.
5  const filename = url.substring(url.lastIndexOf("/") + 1).split("?")[0];
6  let xhr = new XMLHttpRequest();
7  xhr.responseType = "blob";
8  xhr.onload = function () {
9    let a = document.createElement("a");
10    a.href = window.URL.createObjectURL(xhr.response); // xhr.response is a blob
11    a.download = filename; // Set the file name.
12    a.style.display = "none";
13    document.body.appendChild(a);
14    a.click();
15    // delete a;
16  };
17  xhr.open("GET", url);
18  xhr.send();
19}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.