I write function that convert Base64 String to Base64 Hex String and now it is correct converted to display as BLOB png image...but problem is when i open field in DB Browser for SQLite it writes this converted value as Text, and must be written as binary (so that the image will be recognized and displayed when i choose Image in DB Browser for SQLIte...so the question is how can i insert Base64 Hex String to SQLite3 Database as binary?
Here is my code for insert:
/* GET - channels_logo */
for (var i in rows) {
/* WRITE - table channels_logo */
db.prepare('INSERT INTO channels_logo (logo_id, logo_channel, logo_png) VALUES
("'+rows[i].id+'", "'+rows[i].channel+'", "'+(base64toHex(new Buffer(rows[i].logo).toString()))+'")').run();
};
function base64toHex(base64) {
/* DEFINE - variables */
var raw = atob(base64);
var HEX = '';
for (i = 0; i < raw.length; i++) {
var _hex = raw.charCodeAt(i).toString(16)
HEX += (_hex.length==2?_hex:'0'+_hex);
};
return HEX.toUpperCase();
};
[![Using this insert code is inserted as Text:][1]][1]
https://i.stack.imgur.com/iZ2A1.jpg
[![And needs to be binary inserted and now it looks ok (i just erase text and copy text inserted into binary and now it works)][1]][1]
https://i.stack.imgur.com/ZzGTU.jpg
So i see that SQLite3 displays inserted Base64 Hex As Text not binary...what i need to write in insert statement to insert it as binary?