function downFileBlob (src) {
return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest()
xhr.open('GET', src)
xhr.responseType = 'blob' // 二进制文件
xhr.onload = function () {
var blob = this.response
resolve(blob)
}
xhr.send()
})
}
downFileBlob('https://vgopano.obs.cn-east-2.myhuaweicloud.com/cmppano/e5c39d46-3865-41f8-96e6-d9a09e2947a7.jpg')
.then(blob => {
let img = document.createElement('img')
img.src = URL.createObjectURL(blob)
document.body.appendChild(img)
})
console.log(blob)
// return new Promise((resolve, reject) => {
// let img = document.createElement('img')
// img.onload = () => {
// console.log(img.width,img.heights)
// // console.log(new THREE.Texture(img))
// resolve(new THREE.Texture(img))
// }
// img.src = url
// })
console