MCPcopy Index your code
hub / github.com/hoothin/UserScripts / download

Function download

DownloadAllContent/DownloadAllContent.user.js:88–102  ·  view source on GitHub ↗
(url, name, opts)

Source from the content-addressed store, hash-verified

86 }
87
88 function download(url, name, opts) {
89 var xhr = new XMLHttpRequest();
90 xhr.open('GET', url);
91 xhr.responseType = 'blob';
92
93 xhr.onload = function () {
94 saveAs(xhr.response, name, opts);
95 };
96
97 xhr.onerror = function () {
98 console.error('could not download file');
99 };
100
101 xhr.send();
102 }
103
104 function corsEnabled(url) {
105 var xhr = new XMLHttpRequest();

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected