getFileSize() | Zoho QEngine Help

getFileSize()

1. Overview 

The getFileSize() function returns the size of the specified file in bytes. This is useful for validating if a file has been completely downloaded, meets expected size criteria, or to perform conditional logic based on file size.

2. Syntax

<variable> = files.<filename>.getfilesize();

Parameter
Description

<variable>

Defines the response returned by the getFileSize() function. It represents the size of the file in bytes.

<fileObject>

Specifies the file object to be accessed. This can be a file downloaded, invoked via URL, or loaded from saved files.

3. Example

  1. //perform file function action on a file saved locally
  2. FileSize = files.ztest.getfilesize();

 

  1. //perform file function action on a downloaded file
  2. assertFileDownload("downloadedfile.txt",5,errorhandling.STOP_ON_ERROR);
  3. DownloadFile = File("downloadedfile.txt");
  4. FileSize = DownloadFile.getfilesize();

 

  1. //to fetch file using invoke URL and perform file functions
  2. File =  invokeURL[
  3. url : "<downloadURL>"
  4. type:GET
  5. ];
  6. FileSize = File.getfilesize();