Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 如何在Nodejs中将blob文件转换为图像_Node.js_Express - Fatal编程技术网

Node.js 如何在Nodejs中将blob文件转换为图像

Node.js 如何在Nodejs中将blob文件转换为图像,node.js,express,Node.js,Express,我将文件作为filestream数据类型存储在SQL Server数据库中,它返回一个blob。我将nodejs与express一起使用。有没有办法将这些blob转换为图像,并使用nodejs和express将其发送到我的ejs模板? const blobToImage=(blob)=>{ 返回新承诺(解决=>{ 常量url=url.createObjectURL(blob) 设img=newimage() img.onload=()=>{ revokeObjectURL(URL) 解决(img

我将文件作为filestream数据类型存储在SQL Server数据库中,它返回一个blob。我将nodejs与express一起使用。有没有办法将这些blob转换为图像,并使用nodejs和express将其发送到我的ejs模板?

const blobToImage=(blob)=>{
返回新承诺(解决=>{
常量url=url.createObjectURL(blob)
设img=newimage()
img.onload=()=>{
revokeObjectURL(URL)
解决(img)
}
img.src=url
})

}
这是否回答了您的问题?