I came here looking to download the s3 file on the client side. Here's how I solved it:
Since I cannot store my s3 authorization keys on the client side, I used my server-side scripts to generate a pre-signed URL and send it back to the client, for example:
const AWS = require('aws-sdk') const s3 = new AWS.S3() AWS.config.update({accessKeyId: 'your access key', secretAccessKey: 'you secret key'}) const myBucket = 'bucket-name' const myKey = 'path/to/your/key/file.extension' const signedUrlExpireSeconds = 60 * 5
Use this URL in the interface to start the download:
function download(url){ $('<iframe>', { id:'idown', src:url }).hide().appendTo('body').click(); } $("#downloadButton").click(function(){ $.ajax({ url: 'example.com/your_end_point', success: function(url){ download(url); } }) });
new_user
source share