作者:歪歪Doris | 来源:互联网 | 2022-12-08 12:07
我的函数在控制台中登录时会返回一个blob对象:
Blob(623853) {name: "profile.jpg", size: 623853, type: "image/jpeg"}
我想用Javascript向用户显示此图像,我该怎么做?
1> Arun Kumar M..:
尝试
const blobUrl = URL.createObjectURL(blob) // blob is the Blob object
上面的代码行应生成一个Blob URL,您可以将其设置为图像源。
image.src = blobUrl // image is the image element from the DOM