前端imageBuffer设置图片src(后端到前端直传buffer)
本质为buffer转base64
let bytes = new Uint8Array(imageBuffer.data); let data = ""; let len = bytes.byteLength; for (let i = 0; i < len; i++) { data += String.fromCharCode(bytes[i]); } image.src = "data:image/png;base64," + window.btoa(data);