Download File from S3 Bucket API Using AWS .Net SDK
In one of my previous posts Upload File to S3 Bucket API Using AWS .Net SDK I explain how to upload a file to an S3 bucket and get the file path where your file was stored. Assuming that you have persisted this file path somewhere somehow, I will show you in this post how to download the file using the file path. Using the same set-up in my previous post linked above let's start with adding an interface method that performs the needed service. File Data When the S3 SDK gets you the object that exists in the file path and bucket name provided, it's in the form of a stream. You should have a content type so that you are able to tell the receiver of your API what type of file they are getting. Luckily, we can get this information from the Content-Type header from the response, but we need a model that can hold this piece of information. So, let's create a class named FileData which can hold the stream and the content type of the file received from S3. namespace Domain....