I want to download multiple files with different keys as a batch (.zip) e.g, I have keys file1 (abc.txt), file2 (xyz.pdf) and file3 (qwe.png) and I want to download abc.txt and qwe.png using their respective key but all together in a form zip.
I am trying to do it using MVC5 controller C#.
This is for one file. I want for multiple files in a single go.
using (client = new AmazonS3Client(AWSCredentials, RegionEndPoint)) {
GetObjectRequest request = new GetObjectRequest {
BucketName = existingBucketName,
Key = newFileName
};
using (GetObjectResponse response = client.GetObject(request)) {
byte[] buffer = ReadFully(response.ResponseStream);
Response.OutputStream.Write(buffer, 0, buffer.Length);
Response.AddHeader("content-disposition", "attachment; filename=" + newFileName);
}
}
.zip file is the preferred output