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 <FOLDER_INSTANCE> used in the code below is the instance defined in the File Store Instance page.
copyFuture<(APIResponse, ZCatalystFile)> <FOLDER_INSTANCE>.getFile(int id)
Parameters:
- id: The unique File ID of the file to be retrieved
A sample code snippet with the folder instance is shown below:
copyZCatalystFolder folder = ZCatalystApp.getInstance() .getFileStoreInstance() .getFolderInstance(2823000000006561); try{ var (response, file) = await folder.getFile(2823000000006561); print('Get File Success'); print('The name of the file is : ${file.name}'); print('The size of the file is : ${file.size}'); } on ZCatalystException catch (ex) { print(ex.toString); }
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.
copyFuture<(APIResponse, List<ZCatalystFile>)> <FOLDER_INSTANCE>.getFiles()
A sample code snippet with the folder instance is shown below:
copyZCatalystFolder folder = ZCatalystApp.getInstance() .getFileStoreInstance() .getFolderInstance(2823000000006561); //Define the folder instance try{ var (response, files) = await folder.getFiles(); for (var file in files) { print(file.name); //Actions to be executed upon success } } on ZCatalystException catch (ex) { print(ex.toString()); }
Last Updated 2024-09-12 18:16:13 +0530 +0530
Yes
No
Send your feedback to us