AWS SDK Version 4 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.7.2 or higher.

NameDescription
Public Method AbortMultipartUploads(string, DateTime)

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

Public Method AbortMultipartUploads(TransferUtilityAbortMultipartUploadRequest)
Public Method AbortMultipartUploadsAsync(string, DateTime, CancellationToken)

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

Public Method AbortMultipartUploadsAsync(TransferUtilityAbortMultipartUploadRequest, CancellationToken)
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 DownloadDirectoryWithResponse(string, string, string)

Downloads the objects in Amazon S3 that have a key that starts with the value specified by s3Directory, returning response metadata. Uses enhanced multipart download with concurrent part downloads for improved performance.

Public Method DownloadDirectoryWithResponse(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, returning response metadata. Uses enhanced multipart download with concurrent part downloads for improved performance.

Public Method DownloadDirectoryWithResponseAsync(string, string, string, CancellationToken)

Downloads the objects in Amazon S3 that have a key that starts with the value specified by s3Directory and returns response metadata. Uses enhanced multipart download with concurrent part downloads for improved performance.

Public Method DownloadDirectoryWithResponseAsync(TransferUtilityDownloadDirectoryRequest, CancellationToken)

Downloads the objects in Amazon S3 that have a key that starts with the value specified by the S3Directory property and returns response metadata. Uses enhanced multipart download with concurrent part downloads for improved performance.

Public Method DownloadWithResponse(string, string, string)

Downloads the content from Amazon S3 and writes it to the specified file, returning response metadata.

Public Method DownloadWithResponse(TransferUtilityDownloadRequest)

Downloads the content from Amazon S3 based on the request and returns response metadata. To track the progress of the download, add an event listener to the request's WriteObjectProgressEvent.

Public Method DownloadWithResponseAsync(string, string, string, CancellationToken)

Downloads the content from Amazon S3 and writes it to the specified file, returning response metadata.

Public Method DownloadWithResponseAsync(TransferUtilityDownloadRequest, CancellationToken)

Downloads the content from Amazon S3 based on the request and returns response metadata. To track the progress of the download, add an event listener to the request's WriteObjectProgressEvent.

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 OpenStreamWithResponse(string, string)

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

Public Method OpenStreamWithResponse(TransferUtilityOpenStreamRequest)

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

Public Method OpenStreamWithResponseAsync(string, string, CancellationToken)

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

Public Method OpenStreamWithResponseAsync(TransferUtilityOpenStreamRequest, CancellationToken)

Returns a stream to read the contents from Amazon S3 as specified by the TransferUtilityOpenStreamRequest, along with response metadata. 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.

Public Method UploadDirectoryWithResponse(string, string)

Uploads files from a specified directory and returns response metadata. 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 UploadDirectoryWithResponse(string, string, string, SearchOption)

Uploads files from a specified directory and returns response metadata. 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 UploadDirectoryWithResponse(TransferUtilityUploadDirectoryRequest)

Uploads files from a specified directory and returns response metadata. 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 UploadDirectoryWithResponseAsync(string, string, CancellationToken)

Uploads files from a specified directory and returns response metadata. 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 UploadDirectoryWithResponseAsync(string, string, string, SearchOption, CancellationToken)

Uploads files from a specified directory and returns response metadata. 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 UploadDirectoryWithResponseAsync(TransferUtilityUploadDirectoryRequest, CancellationToken)

Uploads files from a specified directory and returns response metadata. 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 UploadWithResponse(string, string)

Uploads the specified file and returns response metadata. 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 UploadWithResponse(string, string, string)

Uploads the specified file and returns response metadata. 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 UploadWithResponse(Stream, string, string)

Uploads the contents of the specified stream and returns response metadata. 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 UploadWithResponse(TransferUtilityUploadRequest)

Uploads the file or stream specified by the request and returns response metadata. 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 UploadWithResponseAsync(string, string, CancellationToken)

Uploads the specified file and returns response metadata. 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 UploadWithResponseAsync(string, string, string, CancellationToken)

Uploads the specified file and returns response metadata. 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 UploadWithResponseAsync(Stream, string, string, CancellationToken)

Uploads the contents of the specified stream and returns response metadata. 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 UploadWithResponseAsync(TransferUtilityUploadRequest, CancellationToken)

Uploads the file or stream specified by the request and returns response metadata. 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.

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:
Supported in: 8.0 and newer, Core 3.1

.NET Standard:
Supported in: 2.0

.NET Framework:
Supported in: 4.7.2 and newer