I'm storing images in a Postgres db in the following way:
const image = Buffer.from("\\x" + Buffer.from(createEventDto.image, "base64").toString("hex"));
Now, I'm trying to read the image back from the db and decode it into a base64 string. I've tried simply this:
const image = await db.get(); // here it's of type buffer
return image.toString("base64"); // want to return it as type string in base64
But the image comes back corrupted.