I'm using AmplifyJS to get object from my S3 bucket. But what I have niticed is that Amplify JS gets me objects either from public folder or some other user's folder. But I have a file at root location of my S3 bucket. How do I get that file from Amplify JS?
For example, if you refer https://aws-amplify.github.io/docs/js/storage#get post, you will see it always appends /public folder after my bucket name. This is what I'm trying to avoid.
Amplify forces me to have folders within my S3 buckets. It would be PUBLIC, PROTECTED or USER's CUSTOM folder.
I got an answer to my question. You can set a customPrefix prefix property while using Amplify JS. here is an example.
const customPrefix = { public: '' };
Storage.get("TestJson.json", { download: true, customPrefix: customPrefix })
.then(result => console.log(JSON.parse(result.Body.toString())))
.catch(err => console.log(err));