When a client makes an authorized request, I need to send a file back as a response. The file is retrieved from the S3
bucket. What steps should I take to retrieve the file from S3
and deliver it to the client?
const s3 = new S3Client({...})
router.get('/getfile', (req, res) => {
const data = await s3.send(
new GetObjectCommand({
Bucket: 'bucket',
Key: 'path',
})
)
// How can we efficiently send back the file?
// res.send(fileStream)
})
What is the best method for sending back the data?