blob
ajanuw.request('get', 'http://127.0.0.1:5500/ajax4/4.jpg', {
resType: 'blob'
}).then(res => {
let url = URL.createObjectURL(res.data);
let img = document.createElement('img')
img.src = url;
document.body.append(img);
img.onload = function () {
URL.revokeObjectURL(this.url)
}
})
arraybuffer
ajanuw.request('get', 'http://127.0.0.1:5500/ajax4/4.jpg', {
resType: 'arraybuffer'
}).then(res => {
let buffer = res.data; // 只有int8
l(buffer)
let url = URL.createObjectURL(new Blob([buffer]), {
type: 'image/jpg'
});
let img = document.createElement('img')
img.src = url;
document.body.append(img);
img.onload = function () {
URL.revokeObjectURL(this.url)
}
})