MCPcopy Index your code
hub / github.com/scriptscat/scriptcat / gmDownloadPromise

Function gmDownloadPromise

example/tests/gm_download_test.js:477–489  ·  view source on GitHub ↗

* Call GM.download (promise form). Returns the Promise itself plus the abort handle. * Also collects onprogress events.

(details)

Source from the content-addressed store, hash-verified

475 * Also collects onprogress events.
476 */
477 function gmDownloadPromise(details) {
478 const progress = [];
479 const opts = {
480 ...details,
481 onprogress(p) {
482 progress.push(p);
483 try { details.onprogress && details.onprogress(p); } catch {}
484 updateProgress(p.loaded ?? p.done ?? 0, p.total ?? p.totalSize ?? -1);
485 },
486 };
487 const ret = GM.download(opts);
488 return { promise: ret, abort: ret && ret.abort, progress };
489 }
490
491 // ---------- The auto test suite ----------
492 // Each entry: { name, manual?: boolean, run: async () => void }

Callers 1

Calls 1

downloadMethod · 0.80

Tested by

no test coverage detected