TdxCloudStorage.DownloadFile(string,TStream,TdxCloudStorageFileProgressCallback) Method
Downloads a specified file to a stream.
Declaration
function DownloadFile(const AFileName: string; AStream: TStream; AProgressCallback: TdxCloudStorageFileProgressCallback = nil): Boolean; overload;
Parameters
Name | Type | Description |
---|---|---|
AFileName | string | The absolute path to a file, starting from a cloud storage’s root. |
AStream | TStream | A stream object. |
AProgressCallback | TdxCloudStorageFileProgressCallback | A callback procedure that tracks 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 optional 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