小编San*_*mar的帖子

将字节数组转换为 angular6 中的图像

我已经从服务器以字节数组的形式发送了图像文件。现在我必须将其转换为jpeg文件并将其显示在网页中。

代码:

app.get('/getPhoto/:hash',function(req, res){
    console.log(req.params.hash);
    invoke = require('/Users/sanjeev.natarajan/ipfs/file1.js');

    invoke.getfile(req.params.hash).then((str)=>{
        console.log("resu",str)

        res.send({"Result":str});
    })
    .catch((error) => {
        res.send({"Error":"error in fetching the file through the hashcode"});
    })    
});
Run Code Online (Sandbox Code Playgroud)

我正在从后端接收数据;现在我需要将其转换为 angular6 中的图像

typescript ipfs angular

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

angular ×1

ipfs ×1

typescript ×1