Get Files

Get the Metadata of a Specific File

You can retrieve the details of a specific file in the File Store, by passing its unique File ID as an argument to the getFile() method, as shown in the code syntax below. This fetches the file object using which you can retrieve the file’s metadata such as the details of its creation, last modification, file size, etc.

The <FILE_STORE_INSTANCE> used in the code below is the instance defined in the File Store Instance page.

    
copy
<FOLDER_INSTANCE>.getFile( id: Long, success: (ZCatalystFile) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<ZCatalystFile>>?

Parameters:

A sample code snippet is shown below:

    
copy
val folder = ZCatalystApp.getInstance().getFileStoreInstance().getFolderInstance(2823000000006561) //Replace this with your Folder ID folder.getFile(2823000000044005, //Replace this with your File ID { file -> println("Get File Success") println("The name of the file is: ${file.name}") println("The size of the file is: ${file.size}") }, { exception -> println("Get File Failed! $exception") })

Get the Metadata of all Files

You can retrieve the details of all the files available in a specific folder using the getFiles() method, as shown in the code syntax below.

The <FOLDER_INSTANCE> used in the code below is the instance defined in the Folder Instance page.

    
copy
<FOLDER_INSTANCE>.getFiles( success: (List<ZCatalystFile>) → Unit, failure: ((ZCatalystException) → Unit)? ): ZCatalystRequest<ZCatalystResponse<ArrayList<ZCatalystFile>>>?

A sample code snippet is shown below:

    
copy
ZCatalystApp.getInstance().getFileStoreInstance().getFolderInstance(2823000000006561).getFiles( //Replace this with your Folder ID { files -> println("Get Files Success") for (file in files){ println("File names: ${file.name}") } }, { exception -> println("Get Files Failed $exception") } )

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