download(url, filename) {
const xhr = new XMLHttpRequest()
xhr.open('GET', url, true)
xhr.responseType = 'blob'
xhr.onload = function() {
if (this.status === 200) {
const blob = this.response
const $a = document.createElement('a')
// blob.type = 'application/octet-stream';
const fileUrl = URL.createObjectURL(blob)
$a.href = fileUrl
$a.download = filename
$a.click()
window.URL.revokeObjectURL(url)
}
}
xhr.send()
}