Here is how you can download a file from AWS using vanilla JavaScript.
let bucket_name = 'name of your bucket';
let folder_name = 'name of your folder';
let file_name = 'name of your file';
fetch('https://' + bucket_name + '.s3.amazonaws.com/' + folder_name + '/' + file_name + '.jpg')
.then(resp => resp.blob())
.then(blob => {
const url = window.URL.createObjectURL(blob);
const a = document.createElement('a');
a.style.display = 'none';
a.href = url;
a.download = file_name.split("/").pop();
document.body.appendChild(a);
a.click();
window.URL.revokeObjectURL(url);
alert('your file has downloaded!');
})
.catch(() => console.log('oh no!'));