Skip to main content

Commands: DownloadAsync

Syntax

#Commands: DownloadAsync

The DownloadAsync method is used to retrieve the file's content and metadata.

Task<Stream> DownloadAsync(string filename, Reference<RavenJObject> metadata = null, long? from = null, long? to = null);
Parameters
filenamestringThe name of a downloaded file
metadataReference<RavenJObject>Reference of metadata object where downloaded file metadata will be placed (if not null, default: null)
fromlong?The number of the first byte in a range when a partial download is requested
tolong?The number of the last byte in a range when a partial download is requested

Return Value
Task<Stream>A task that represents the asynchronous download operation. The task result is a file's content represented by a readable stream.

Example

var metadata = new Reference<RavenJObject>();

var data = await store
.AsyncFilesCommands
.DownloadAsync(
"/movies/intro.avi",
metadata,
from: 0,
to: 200);