I can download a file from the Amazon S3 Storage with below code,
var s3Client = new AmazonS3Client(txt_Accesskey.Text, txt_Secretkey.Text, bucketRegion);
GetObjectRequest request = new GetObjectRequest();
request.BucketName = bucketName;
request.Key = "Sample.txt";
GetObjectResponse response = s3Client.GetObject(request);
response.WriteResponseStreamToFile(@"C:\Desktop\Sample.txt");
But, I want to download these files as Byte Array. Can anyone please give me a solution for this?
Just quickly looking at the docs, you maybe able to do this
using (GetObjectResponse response = client.GetObject(request))
bytes = response.ResponseStream.ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With