AWS SDK Version 3 for .NET
API Reference

AWS services or capabilities described in AWS Documentation may vary by region/location. Click Getting Started with Amazon AWS to see specific differences applicable to the China (Beijing) Region.

Provides a high level utility for managing transfers to and from Amazon S3.

TransferUtility provides a simple API for uploading content to and downloading content from Amazon S3. It makes extensive use of Amazon S3 multipart uploads to achieve enhanced throughput, performance, and reliability.

When uploading large files by specifying file paths instead of a stream, TransferUtility uses multiple threads to upload multiple parts of a single upload at once. When dealing with large content sizes and high bandwidth, this can increase throughput significantly.

Inheritance Hierarchy

System.Object
  Amazon.S3.Transfer.TransferUtility

Namespace: Amazon.S3.Transfer
Assembly: AWSSDK.S3.dll
Version: 3.x.y.z

Syntax

C#
public class TransferUtility
         IDisposable, ITransferUtility

The TransferUtility type exposes the following members

Constructors

Properties

NameTypeDescription
Public Property S3Client Amazon.S3.IAmazonS3

Gets the Amazon S3 client used for making calls into Amazon S3.

Methods

Note:

Asynchronous operations (methods ending with Async) in the table below are for .NET 4.5 or higher. For .NET 3.5 the SDK follows the standard naming convention of BeginMethodName and EndMethodName to indicate asynchronous operations - these method pairs are not shown in the table below.

NameDescription
Public Method AbortMultipartUploads(string, DateTime)

Aborts the multipart uploads that were initiated before the specified date.

Public Method AbortMultipartUploadsAsync(string, DateTime, CancellationToken)

Aborts the multipart uploads that were initiated before the specified date.

Public Method Dispose()

Disposes of all managed and unmanaged resources.

Public Method Download(string, string, string)

Downloads the content from Amazon S3 and writes it to the specified file.

Public Method Download(TransferUtilityDownloadRequest)

Downloads the content from Amazon S3 and writes it to the specified file. If the key is not specified in the request parameter, the file name will used as the key name.

Public Method DownloadAsync(TransferUtilityDownloadRequest, CancellationToken)

Downloads the content from Amazon S3 and writes it to the specified file. If the key is not specified in the request parameter, the file name will used as the key name.

Public Method DownloadAsync(string, string, string, CancellationToken)

Downloads the content from Amazon S3 and writes it to the specified file.

Public Method DownloadDirectory(string, string, string)

Downloads the objects in Amazon S3 that have a key that starts with the value specified by s3Directory.

Public Method DownloadDirectory(TransferUtilityDownloadDirectoryRequest)

Downloads the objects in Amazon S3 that have a key that starts with the value specified by the S3Directory property of the passed in TransferUtilityDownloadDirectoryRequest object.

Public Method DownloadDirectoryAsync(string, string, string, CancellationToken)

Downloads the objects in Amazon S3 that have a key that starts with the value specified by s3Directory.

Public Method DownloadDirectoryAsync(TransferUtilityDownloadDirectoryRequest, CancellationToken)

Downloads the objects in Amazon S3 that have a key that starts with the value specified by the S3Directory property of the passed in TransferUtilityDownloadDirectoryRequest object.

Public Method OpenStream(string, string)

Returns a stream from which the caller can read the content from the specified Amazon S3 bucket and key. The caller of this method is responsible for closing the stream.

Public Method OpenStream(TransferUtilityOpenStreamRequest)

Returns a stream to read the contents from Amazon S3 as specified by the TransferUtilityOpenStreamRequest. The caller of this method is responsible for closing the stream.

Public Method OpenStreamAsync(string, string, CancellationToken)

Returns a stream from which the caller can read the content from the specified Amazon S3 bucket and key. The caller of this method is responsible for closing the stream.

Public Method OpenStreamAsync(TransferUtilityOpenStreamRequest, CancellationToken)

Returns a stream to read the contents from Amazon S3 as specified by the TransferUtilityOpenStreamRequest. The caller of this method is responsible for closing the stream.

Public Method Upload(string, string)

Uploads the specified file. The object key is derived from the file's name. Multiple threads are used to read the file and perform multiple uploads in parallel. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method Upload(string, string, string)

Uploads the specified file. Multiple threads are used to read the file and perform multiple uploads in parallel. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method Upload(Stream, string, string)

Uploads the contents of the specified stream. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method Upload(TransferUtilityUploadRequest)

Uploads the file or stream specified by the request. To track the progress of the upload, add an event listener to the request's UploadProgressEvent. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadAsync(string, string, CancellationToken)

Uploads the specified file. The object key is derived from the file's name. Multiple threads are used to read the file and perform multiple uploads in parallel. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadAsync(string, string, string, CancellationToken)

Uploads the specified file. Multiple threads are used to read the file and perform multiple uploads in parallel. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadAsync(Stream, string, string, CancellationToken)

Uploads the contents of the specified stream. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadAsync(TransferUtilityUploadRequest, CancellationToken)

Uploads the file or stream specified by the request. To track the progress of the upload, add an event listener to the request's UploadProgressEvent. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadDirectory(string, string)

Uploads files from a specified directory. The object key is derived from the file names inside the directory. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadDirectory(string, string, string, SearchOption)

Uploads files from a specified directory. The object key is derived from the file names inside the directory. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadDirectory(TransferUtilityUploadDirectoryRequest)

Uploads files from a specified directory. The object key is derived from the file names inside the directory. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadDirectoryAsync(string, string, CancellationToken)

Uploads files from a specified directory. The object key is derived from the file names inside the directory. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadDirectoryAsync(string, string, string, SearchOption, CancellationToken)

Uploads files from a specified directory. The object key is derived from the file names inside the directory. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Public Method UploadDirectoryAsync(TransferUtilityUploadDirectoryRequest, CancellationToken)

Uploads files from a specified directory. The object key is derived from the file names inside the directory. For large uploads, the file will be divided and uploaded in parts using Amazon S3's multipart API. The parts will be reassembled as one object in Amazon S3.

Remarks

Transfers are stored in memory. If the application is restarted, previous transfers are no longer accessible. In this situation, if necessary, you should clean up any multipart uploads that are incomplete.

Version Information

.NET Standard:
Supported in: 1.3

.NET Framework:
Supported in: 4.5, 4.0, 3.5

Portable Class Library:
Supported in: Windows Store Apps
Supported in: Windows Phone 8.1
Supported in: Xamarin Android
Supported in: Xamarin iOS (Unified)
Supported in: Xamarin.Forms