This code is upload objects on s3 successfully but I was not able to figure out how to get uploaded object url return.
Code snnipet
let s3 = new aws.S3({
accessKeyId: 'XXXXXXXXXXXXX',
secretAccessKey: 'XXXXXXXXXXXXXXXXXXXXXXXXX',
region: 'XXXXXXXX'
});
let upload = multer({
storage: multerS3({
s3: s3,
acl: 'public-read',
bucket: 'XXXXXXXXXXx',
metadata: (req: any, file: any, cb: any) => {
cb(null, { fieldName: file.fieldname });
},
key: (req: any, file: any, cb: any) => {
cb(null, Date.now().toString() + '-' + file.originalname)
}
})
});
routes.post(`api/upload-image`, upload.single('photo'), async (req: any, res: Response) => {
res.send('Image uploaded successfully');
});
Is there any way or callback for getting the url?