2
I need to display images that are saved in the database (Firebird) in Blob and I’m not able to go through with this.
is returned a BD Function
this Function is read according to the function below.
henceforth I would need to return the image by (res.json) to my front-end or save this image in a directory.
router.get("/vitrineGrid",function(req,res){
query = "SELECT ID, IMAGEM from FOTOS";
connection.query(query,function(err,rows){
if(err) {
res.json({"Error" : true, "Message" : "Error executing query"});
} else {
rows[0].IMAGEM(function(err, name, eventEmitter) {
eventEmitter.on('data', function(chunk) {
//reading
console.log(chunk); // buffer da print
});
eventEmitter.on('end', function() {
// end reading
});
});
res.json({"Error" : false, "Message" : "Success", "fotos" : rows});
}
connection.detach();
});
});
You need to use the HTML5 file API, in English see this post https://www.html5rocks.com/pt/tutorials/file/dndfiles/
– John Henrique