admin管理员组

文章数量:1024603

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 badges
Add a ment  | 

1 Answer 1

Reset to default 5

Try this

fetch('https://bucketnmame.s3.amazonaws./folder1/folder2/file.txt')
    .then ((response) => response.text())
    .then (data => {
      console.log(data)
    });

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 badges
Add a ment  | 

1 Answer 1

Reset to default 5

Try this

fetch('https://bucketnmame.s3.amazonaws./folder1/folder2/file.txt')
    .then ((response) => response.text())
    .then (data => {
      console.log(data)
    });

本文标签: javascriptRead txt file from AWS S3 storage in ReactJSStack Overflow