S3 User Download Without Local File

Question:

I am creating a front end web app that connects to Wasabi for S3 storage. I currently have the ability to download a file from my web app, but it requires a local download on the server to send to the user.

I am trying to send the files from S3 to the user, via my web app, without the local download. I know S3 has the ability to retrieve the file as an object, is it possible to zip the contents of the object with ZipFile? Or perhaps create a link that is sent to the user to download without making the bucket public?

Thanks in advance!

Asked By: Josh Cingel

||

Answers:

From this post, you could generate a presigned url that your user could use to download the file.
The code should look like :

const AWS = require('aws-sdk')
const s3 = new AWS.S3()
AWS.config.update({accessKeyId: 'id-omitted', secretAccessKey: 'key-omitted'})
const url = s3.getSignedUrl('getObject', {
   Bucket: myBucket,
   Key: myKey,
   Expires: signedUrlExpireSeconds
})
console.log(url)
Answered By: Alexandre_Bon