Skip to main content

TdxCloudStorage.DownloadFile(TdxCloudStorageFile,TStream,TdxCloudStorageFileProgressCallback) Method

Downloads a specified file from the cloud storage to a stream.

Declaration

function DownloadFile(AFile: TdxCloudStorageFile; AStream: TStream; AProgressCallback: TdxCloudStorageFileProgressCallback = nil): Boolean; overload;

Parameters

Name Type Description
AFile TdxCloudStorageFile

A cloud file metadata container that corresponds to the target file.

AStream TStream

A stream object.

AProgressCallback TdxCloudStorageFileProgressCallback

A callback procedure that tracks file download progress.

Returns

Type Description
Boolean

True if the target file was downloaded successfully; otherwise, False.

Remarks

The following code example downloads the Image.jpg file from the Images folder in a connected cloud storage.

var
  AStream: TMemoryStream;
//...
  AStream := TMemoryStream.Create;
  dxCloudStorage1.DownloadFile('/Images/Image.jpg', AStream);

You can also implement a callback procedure and pass it as the AProgressCallback parameter to track file download progress. Refer to the TdxCloudStorageFileProgressCallback procedural type description for details.

Note

The DownloadFile function always runs in the same thread from which it is called.

See Also