I am trying to read text file from s3 storage in ReactJS. I have the s3 bucket link of the text file. However, I am not able to read the text file from the link. I have googled a lot about this, but everywhere people are reading the file locally and not from a link.
The link of the file looks like this:
.txt
This link is being stored in database with NodeJS as backend. Would be great if someone helps me...
I am trying to read text file from s3 storage in ReactJS. I have the s3 bucket link of the text file. However, I am not able to read the text file from the link. I have googled a lot about this, but everywhere people are reading the file locally and not from a link.
The link of the file looks like this:
https://bucketnmame.s3.amazonaws./folder1/folder2/file.txt
This link is being stored in database with NodeJS as backend. Would be great if someone helps me...
Share Improve this question asked Sep 17, 2021 at 3:52 AdityaAditya 3702 silver badges15 bronze badges1 Answer
Reset to default 5Try this
fetch('https://bucketnmame.s3.amazonaws./folder1/folder2/file.txt')
.then ((response) => response.text())
.then (data => {
console.log(data)
});