Basically I have an image created using Canvas and it's in base64 encoded data URI. This data URI is then attached to email.
...,
attachments:[{
filename: "cat.jpg",
contents: new Buffer(cat, 'base64')
}],
The email is received but the attachment is not viewable. Running $ file cat.jpg
in linux returns:
cat.jpg: ASCII text, with very long lines, with no line terminators
Why is this ASCII? I had already mentioned base64. How may I fix this problem? Thank you.