'Converting of Binary Data in Javascript

map.loadImage('works/static/src/img/icon2.png', function(error, image) {
     if (error)
     {
        console.log(error)
     }
     map.addImage('icon2', image);

Hello everyone.I am woking on the a web map project by using maplibre-gl-js.I can add an icon to my map by using above the code but I want to get to image from my database and the image is stored as binary format.How can to convert to this binary data to adding my map ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source