Get Files

Note: Catalyst now offers you a brand new object storage component called Stratus in Early Access mode. This component is a significant upgrade to the current Cloud Scale File Store component. You can find out more about the Stratus component here.

To use the Stratus component in the Early Access mode, email us at support@zohocatalyst.com.

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 Folder Instance page.

    
copy
<FOLDER_INSTANCE>.getFile( fileId : Int64, completion : @escaping ( Result< ZCatalystFile, ZCatalystError > ) -> Void )

Parameters:

  • id: The unique File ID of the file to be retrieved

  • completion: If the operation is successful, the completion block will return with the file details. Else, it will return an error.

A sample code snippet is shown below:

    
copy
ZCatalystApp.shared.getFileStoreInstance().getFolderInstance(id : 105000000121098) .getFile(fileId : 332000000044009){(result) in
//Replace this with your Folder ID and File ID
switch result {
case .success ( let file) :
print("The name of the file is " + file.name)
case .error( let error ) :
print( "Error occurred >>> \( error )" )
}
}

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( completion : @escaping ( Result< [ ZCatalystFile ], ZCatalystError > ) -> Void )

Parameters:

  • completion: If the operation is successful, the completion block will return the details of all the files. Else, it will return an error.

A sample code snippet is shown below:

    
copy
ZCatalystApp.shared.getFileStoreInstance().getFolderInstance(id : 105000000121098) .getFiles {(result) in
//Replace this with your Folder ID
switch result {
case .success ( let files) :
for file in files{
print("The names of the folder are \(file.name)")
}
case .error( let error ) :
print( "Error occurred >>> \( error )" )
}
}

Last Updated 2025-02-24 14:38:44 +0530 +0530

ON THIS PAGE
ACCESS THIS PAGE