Download a File

Note: Catalyst now offers you a brand new object storage component called Stratus in Early Access mode. This component is a significant upgrade to the current Cloud Scale File Store component. You can find out more about the Stratus component here.

To use the Stratus component in the Early Access mode, email us at support@zohocatalyst.com.

You can download a file from an existing folder in the File Store by calling the download() method. The file will be automatically downloaded to file path that you set and will be assigned the file name that you configure. You can pass these values as arguments to the download() method as shown in the example.

The <FILE_INSTANCE> used in the code below is an instance created for the specific file, as shown in the sample code snippet. This will refer to the file from the specific folder that must be downloaded by its unique File ID.

    
copy
Future<(APIResponse, String)> <FILE_INSTANCE>.download(
void Function(int, int, double) inProgress)

A sample code snippet with the file instance is shown below:

    
copy
ZCatalystFolder folder = ZCatalystApp.getInstance()
.getFileStoreInstance()
.getFolderInstance(2823000000006561);
try{
var (_, file) = folder.getFile(2823000000006561);
var (_, downloadedFilePath) = await file.download(
filePath: '/desktop/files/',
fileName: 'red.webp',
onProgress: (bytesWritten, contentLength, percentage) {
print('${percentage}%');
});
print(downloadedFilePath);
} on ZCatalystException catch (ex) {
print(ex.toString());
}

Last Updated 2025-02-24 14:38:44 +0530 +0530

ON THIS PAGE
ACCESS THIS PAGE