FileSize

The FileSize object is provided to make it easier to deal with variables representing file sizes. It's very common these days for files to be larger than 4GB but unfortunately ActiveX scripting does not have proper support for the 64-bit integers needed to represent such large numbers. Therefore, any time a file size or number representing a number of bytes is returned by the Opus scripting objects, it is as a FileSize object. For example, the Item.size property returns a FileSize representing the size of a particular file or folder.

You can create a new FileSize object using the FSUtil.NewFileSize method. A FileSize object normally represents an unsigned 64 bit integer but if you specify the "s" flag on creation, it will store a signed integer instead.

  

Property Name

Return Type

Description

<default value>

string

Returns the number of bytes represented by this FileSize object as a string.

cy

currency

Returns the number of bytes as a currency value. This is a 64 bit data type but it is stored as a fractional value, so you must multiply the returned value by 10000 to obtain the actual byte size.

fmt

string

Returns the number of bytes as an automatically formatted string (e.g. if the FileSize value is 1024, the string 1 KB would be returned).

high 

int

Returns the highest (most significant) 32 bits of the file size.

low

int

Returns the lowest (least significant) 32 bits of the file size.

 

Method Name

Arguments

Return Type

Description

Add

variant

none

Adds the supplied value to the value of this FileSize object. You can pass a string, int or currency type, or another FileSize object.

Clone

none

object:FileSize

Clones this FileSize object and returns a new one set to the same value.

Compare

variant

int

Compares the supplied value with the value of this FileSize object. The return value will be 0 (equal), 1 (greater) or -1 (less).

Div

variant

none

Divides the value of this FileSize object with the supplied value. You can pass a string, int or currency type, or another FileSize object.

Mult

variant

none

Multiplies the value of this FileSize object with the supplied value. You can pass a string, int or currency type, or another FileSize object.

Set

variant

none

Sets the FileSize to the supplied value. You can pass a string, int or currency type, or another FileSize object.

Sub

variant

none

Subtracts the supplied value from the value of this FileSize object. You can pass a string, int or currency type, or another FileSize object. Note that the FileSize object is unsigned and so the value cannot go below zero.