Search code examples
javascriptaws-sdk-js

How to download S3 object data using plain Javascript (no Node)


So I am using AWS Javascript SDK to S3 object, using this method:

http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/S3.html#getObject-property

The call completed successfully, however it only shows the Object data with string.

How can I download this file from browser with only plain Javascript?


Solution

  • The documentation clearly states in the Callback section of the getObject method that data.Body will return a "Buffer, Typed Array, Blob, String, ReadableStream".

    That's your file.