You are currently browsing legacy 3.0 version of documentation. Click here to switch to the newest 4.2 version.

We can help you with migration to the latest RavenDB

Contact Us Now
see on GitHub

Commands: DownloadAsync

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

Syntax

Task<Stream> DownloadAsync(string filename, Reference<RavenJObject> metadata = null, long? from = null, long? to = null);

Parameters
filename string The name of a downloaded file
metadata Reference<RavenJObject> Reference of metadata object where downloaded file metadata will be placed (if not null, default: null)
from long? The number of the first byte in a range when a partial download is requested
to long? 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);