Skip to content

Can someone explain me how I'm supposed to send images using Buffer? #264

Answered by ynbh
ynbh asked this question in Q&A
Discussion options

You must be logged in to vote

Hey everyone. I figured out the issue. I was encoding the base64 string incorrectly.

Previously:

const buff = Buffer.from(name,'base64')

Now:

const buff = Buffer.from(name.replace(/^data:image\/\w+;base64,/, ""),'base64')

Refer this for more information!

Hope this helps.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ynbh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant