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( int id, void Function(ZCatalystFile) onSuccess, void Function(ZCatalystException) onFailed )

Parameters:

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

    
copy
ZCatalystFolder folder = ZCatalystApp.getInstance() .getFileStoreInstance() .getFolderInstance(2823000000006561); folder.getFile( 2823000000006561, //Use the folder instance and specify the file ID of the file whose details need to be fetched (APIResponse response, ZCatalystFile file) { print('Get File Success'); print('The name of the file is : ${file.name}'); print('The size of the file is : ${file.size}'); //Actions to be executed upon success }, (ZCatalystException exception) { print('Get File failed: $exception'); //Actions to be executed upon failure }, );

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( void Function(ZCatalystFile) onSuccess, void Function(ZCatalystException) onFailed )

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

    
copy
ZCatalystFolder folder = ZCatalystApp.getInstance() .getFileStoreInstance() .getFolderInstance(2823000000006561); //Define the folder instance folder.getFiles( (APIResponse response, List<ZCatalystFile> files) { print('Get Files Success'); for (var file in files) { print(file.name); //Actions to be executed upon success } }, (ZCatalystException exception) { print('Get Files failed: ${exception}'); //Actions to be executed upon failure }, );

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