Updated on 2024-12-09 GMT+08:00

Downloading an Object

If you have any questions during the development, post them on the Issues page of GitHub. For details about parameters and usage of each API, see the API Reference.

This example downloads object objectname from bucket bucketname.

The example code is as follows:

GetObjectRequest request = new GetObjectRequest()
{
    BucketName = "bucketname",
    ObjectKey = "objectname",
};
using (GetObjectResponse response = client.GetObject(request))
{
    //Save the object locally. 
    string dest = "savepath";
    if (!File.Exists(dest))
    {
        response.WriteResponseStreamToFile(dest);
    }
}