Discuss this help topic in SecureBlackbox Forum
Clouds: Download file
Box.com supports partial download of files.
To download a file from Box.com take the following steps:
- Acquire an instance of TElBoxFile for the needed file
either by calling TElBoxDataStorage.AcquireFile()
or as a result of folder list operation.
- Create a stream to which the data will be written.
- Call TElBoxFile.Read() or TElBoxDataStorage.ReadObject()
to download file data completely.
To download just a part of file, use the overload of TElBoxFile.Read() method,
which lets you specify the parameters of the part, that you need to download.
Alternatively use TElBoxDataStorage.ReadBlock() method.
Note that to read the file in parts you need to enable passthrough mode by setting PassthroughMode property to true.
-
If you used AcquireFile() method to obtain an instance of TElBoxFile or cloned TElBoxFile,
remember to use TElBoxFile.Release() method after the download is complete.
C#:
TElBoxFile file = storage.AcquireFile(@"...");
try
{
FileStream output = new FileStream(@"X:\downloaded.bin", FileMode.Create);
try
{
file.Read(output);
}
finally
{
output.Close();
}
}
finally
{
file.Release();
}
TElBoxDataStorage class has OnProgress event,
which allows to track and show the progress of data download, and interrupt the transfer if necessary.
If the file was encrypted or signed when it was uploaded to the server,
then during downloading of such files the additional steps are to be taken.
How To articles about Box.com cloud
Discuss this help topic in SecureBlackbox Forum