Thursday 19 September 2019

Download file retrieved from AWS via NodJs over Angular?

User clicks on link, in Angular link has a bound function that sends a get request to NodeJS, I can see that NodJs gets the file/buffer stuff, and now I've been stuck on how to send file to user. Here is the current logic: app.get('/api/file', (req, res) => { let params = { 'Bucket': awsFun.createBucketName(req), 'Key': req.query.fileName } s3.getObject(params, (err, data) => { if (err) console.log(err, err.stack); else res.status(200).send(data); }); });

Submitted September 19, 2019 at 10:32PM by sinithw

No comments:

Post a Comment