Delen via


BackgroundDownloader.CreateDownloadAsync Method

Definition

Creates an asynchronous download operation that includes a URI, the file that the response will be written to, and the IInputStream object from which the file contents are read.

public:
 virtual IAsyncOperation<DownloadOperation ^> ^ CreateDownloadAsync(Uri ^ uri, IStorageFile ^ resultFile, IInputStream ^ requestBodyStream) = CreateDownloadAsync;
/// [Windows.Foundation.Metadata.RemoteAsync]
IAsyncOperation<DownloadOperation> CreateDownloadAsync(Uri const& uri, IStorageFile const& resultFile, IInputStream const& requestBodyStream);
[Windows.Foundation.Metadata.RemoteAsync]
public IAsyncOperation<DownloadOperation> CreateDownloadAsync(System.Uri uri, IStorageFile resultFile, IInputStream requestBodyStream);
function createDownloadAsync(uri, resultFile, requestBodyStream)
Public Function CreateDownloadAsync (uri As Uri, resultFile As IStorageFile, requestBodyStream As IInputStream) As IAsyncOperation(Of DownloadOperation)

Parameters

uri
Uri Uri

The location of the resource.

resultFile
IStorageFile

Represents the file that the response will be written to.

requestBodyStream
IInputStream

A stream that represents the request entity body.

Returns

The resultant asynchronous download operation.

Attributes

Remarks

Background transfer doesn't support concurrent downloads of the same Uri. So an app can download http://example.com/myfile.wmv once, or download it again after a previous download completed. An app shouldn't start two downloads of the same Uri concurrently, since this may result in truncated files.

Note

Some file systems have file size limits. Background transfer has special logic to fast-fail transfers that exceed the destination drive's file size limits (for example, files that exceed 4GB in size for FAT32 file systems). If the server responds with a Content-Length header value greater than the file system's maximum file size, then the download operation immediately fails with HRESULT_FROM_WIN32(ERROR_FILE_SYSTEM_LIMITATION).

Applies to

See also