Download a File

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.

<FILE_INSTANCE>.download( void Function(InputStream) onSuccess, void Function(ZCatalystException) onFailed, void Function(int, int, double) inProgress )

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

ZCatalystFolder folder = ZCatalystApp.getInstance() .getFileStoreInstance() .getFolderInstance(2823000000006561); folder.getFile( 2823000000006561, (APIResponse response, ZCatalystFile file) { filePath: '/desktop/files/', fileName: 'red.jpg', onSuccess: (FileAPIResponse fileApiResponse, String downloadFilePath) { print(downloadFilePath); }, onProgress: (int bytesWritten, int contentLength, double percentage) { print('${percentage}%'); }, onFailed: (exception) { print('Failed to download the file: ${exception}'); }); }, (ZCatalystException exception) { print('Get File failed: $exception'); }, );

Last Updated 2023-09-03 01:06:41 +0530 +0530