MCPcopy
hub / github.com/eligrey/FileSaver.js / download

Function download

src/FileSaver.js:34–45  ·  view source on GitHub ↗
(url, name, opts)

Source from the content-addressed store, hash-verified

32}
33
34function download (url, name, opts) {
35 var xhr = new XMLHttpRequest()
36 xhr.open('GET', url)
37 xhr.responseType = 'blob'
38 xhr.onload = function () {
39 saveAs(xhr.response, name, opts)
40 }
41 xhr.onerror = function () {
42 console.error('could not download file')
43 }
44 xhr.send()
45}
46
47function corsEnabled (url) {
48 var xhr = new XMLHttpRequest()

Callers 1

FileSaver.jsFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected