Display a blob image in JS

1

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();
    });
  });

    
asked by anonymous 27.09.2017 / 23:57

1 answer

0

You need to use the HTML5 File API, see this post link

p>     
01.10.2017 / 01:41