0

I am currently generating s3 presigned url links with this code. It works fine but when I open the link it plays the .wav file in chrome. I just want it to download to my computer. Anyway I can modify this code to do that or add anything?

  const url = s3.getSignedUrl('getObject', {
    Bucket: myBucket,
    Key: myKey,
    Expires: signedUrlExpireSeconds
  });
  resolve(url)

Thanks

Juliette
  • 4,309
  • 2
  • 14
  • 31
  • Try this: [javascript - How to force chrome to download files not opening them? - Stack Overflow](https://stackoverflow.com/questions/41887975/how-to-force-chrome-to-download-files-not-opening-them) – John Rotenstein Jul 20 '21 at 00:29

1 Answers1

2

You can set the query parameter response-content-disposition=attachment. Look at this examples, specifically this one "Sample Request: Parameters altering response header values" here https://docs.aws.amazon.com/AmazonS3/latest/API/API_GetObject.html

Andrés Muñoz
  • 559
  • 3
  • 8