0
votes

I want to upload multiple images to my S3 bucket. What I wish to do is User can upload zip file of multiple Images. And from the back-end I want to Unzip the folder and place all the images into specific location in S3 bucket.

Currently I'm uploading single images using the following code.

let S3Instance = new S3({
    accessKeyId: process.env.AWS_ID,
    secretAccessKey: process.env.AWS_SECRET,
});

let Upload = multer({
    storage: multers3({
        s3: S3Instance,
        bucket: process.env.BUCKET || "test-bucket",
        metadata: function (req, file, cb) {
            cb(null, { fieldName: file.fieldname });
        },
        key: function (req, file, cb) {
            cb(null, uuid() + path.extname(file.originalname));
        },
    }),
});

I want to achieve this using node.