Download a File

You can download a file from an existing folder in the File Store by calling the download() method. The operation will return a temporary URL where the file is stored.

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
<FILE_INSTANCE>.download( success: (InputStream) → Unit, failure: ((ZCatalystException) → Unit)?, progress: ((Long, Long, Double) → Unit)? ): ZCatalystRequest<ResponseBody>?

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getFileStoreInstance().getFolderInstance(2823000000006561).getFile(2823000000044005, //Replace this with your Folder ID and File ID { file -> file.download( { println("File download success ${it.available()}") }, { println("File download failed $it") }, { bytesWritten, contentLength, percentage -> println(">> Percentage - $percentage") println(">> Bytes Written - $bytesWritten") println(">> Content Length - $contentLength") } ) })

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