I need to display images that are saved in the database (firebird) in Blob and I can not go forward with it.
a BD function is returned
Thisfunctionisreadbythefunctionbelow.
FromnowonIwouldneedtoreturntheimagethrough(res.json)tomyfrontendorsavethisimagetoadirectory.
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();
});
});