I'm trying to get an image as a response using the public URL of the file :
var request = require('request');
request('https://bucket-name.s3.amazonaws.com/file-name').pipe(res);
when I send the request this is the response I get
I need to know how can I get an image file as response instead of that.
Here's the upload function that works fine
const fileContent = fs.readFileSync(fileName);
// Setting up S3 upload parameters
const params = {
Bucket: BUCKET_NAME,
Key: '30.png', // File name you want to save as in S3
Body: fileContent,
};
// Uploading files to the bucket
s3.upload(params, function (err, data) {
if (err) {
throw err;
}
console.log(`File uploaded successfully. ${data.Location}`);
});
};```