I have these type of strings in a mongodb collection See this link: https://controlc.com/089aba3c7
I transform it like this in JavaScript, but then I get a blank image
item = item.replace("b'", "");
item = item.substring(0, item.length - 1);
let url = btoa(item.replace(/\\x([0-9a-f]{2})/ig, function(_, pair) {
return String.fromCharCode(parseInt(pair, 16));
}))
const imageUrl = 'data:image/jpeg;base64,' + url;
If I try to bencode64 in python directly, I get a similar(the start match, but then they do not match) string, but it seems to be the right image.
import base64
example_img = SAME STRING AS ABOVE
m = eval(example_img)
m = base64.b64encode(m)
print(m)
What am I missing... Why don't I get the exact same response in both scenarios?