Reputation: 404
I want to attach a file that can be either image or txt or pdf in my SendGrid mail. The file is present in S3 bucket. Is there any way through which we can achieve it? Here is my code
s3.getObject(params, (err, data) => { if (err) console.error(err); else { const base64data = data.Body.toString('base64'); console.log(
file has been created!
); } });
Firstly, I have to download it, so it's a lengthly process & it will also consume my storage memory. iS there a shorter way.
Upvotes: 1
Views: 952
Reputation: 1223
The way to do it is by not saving but simple decoding the file to base64
Upvotes: 0