(url, name, opts)
| 32 | } |
| 33 | |
| 34 | function 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 | |
| 47 | function corsEnabled (url) { |
| 48 | var xhr = new XMLHttpRequest() |