Skip to content
Advertisement

Tag: base64

How to convert Buffer to base64 image in Node js

I am getting data from my SQL database like this: How can I convert result to a base64 image in Node.js? For Example: ‘data:image/png;base64,iVBORw0KGgoAAAANS’ Answer Since you’re receiving a Buffer back as output, Buffer.toString(‘base64’) will convert the raw binary data in the buffer to a base64 representation of the data. Buffer.toString() can also take other encodings, you can read more

Convert VARBINARY to Base64 in MySQL

This seems like a basic scenario, but I can’t find relevant info anywhere. I’m new to MySQL, coming from years of Microsoft SQL Server experience. In MySQL, how do you convert a BINARY or VARBINARY value into a Base64 string, and vice-versa? In Microsoft SQL Server, I’ve been using code like this: According to mysql.com, it looks like the TO_BASE64

Advertisement