I have received the image file as a byte array from the server. My next step is to convert it into a jpeg
file and then display it on a webpage.
Here's the code:
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("result", str)
res.send({"Result": str});
})
.catch((error) => {
res.send({"Error": "An error occurred while fetching the file using the hashcode"});
})
});
I've successfully retrieved the data from the backend, now I just need to convert it into an image in Angular6.