How to store Images in S3 bucket?
in my express application, I have my images being saved to a folder in my repo.
However i dont think this is correct i should store them somewhere else, i thought s3 would be a good option.
Ive never done it before so i have no idea how it works.
My currrent code saves the image after scaling it:
// check if there is no new file to resize
if (!req.file) {
next(); // skip to the next middleware
return;
}
const extension = req.file.mimetype.split('/')[1]
req.body.photo = `${uuid.v4()}.${extension}`
// now we resize
const photo = await jimp.read(req.file.buffer)
await photo.cover(300, 300);
// await photo.resize(800, jimp.AUTO);
await photo.write(`./public/uploads/${req.body.photo}`);
// once we have written the photo to our filesystem, keep going!
next()
};```
Whats the process in order to save the images to aws s3?
Thanks