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

Function download

Picviewer CE+/dist.user.js:122–136  ·  view source on GitHub ↗
(url, name, opts)

Source from the content-addressed store, hash-verified

120 }
121
122 function download(url, name, opts) {
123 var xhr = new XMLHttpRequest();
124 xhr.open('GET', url);
125 xhr.responseType = 'blob';
126
127 xhr.onload = function () {
128 saveAs(xhr.response, name, opts);
129 };
130
131 xhr.onerror = function () {
132 console.error('could not download file');
133 };
134
135 xhr.send();
136 }
137
138 function corsEnabled(url) {
139 var xhr = new XMLHttpRequest(); // use sync to avoid popup blocker

Callers 1

dist.user.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected