---
title: "Class FileVersion"
slug: "js-sdk--fileversion"
abstract: ""
---
# Class FileVersion

Represents the file version of an assembly

## Constructors

### FileVersion()

#### Declaration

```csharp
new FileVersion()
```

### Functions

### parse(fileVersion)

Parses a file version string (format: `<major>.<minor>.<patch>.<revision>`) to an instance.

#### Declaration

```csharp
function parse(fileVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *fileVersion* | The file version string to parse |

#### Returns

| Type | Description |
| --- | --- |
|  | A file version instance. |

### tryParse(fileVersion, defaultValue)

Tries to parse a file version string (see [parse(fileVersion)](https://doc.sitecore.com/ch/en/developers/api-reference/js-sdk--fileversion.html)) and returns `null` or the specified default value when it fails.

#### Declaration

```csharp
function tryParse(fileVersion, defaultValue)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *fileVersion* | The file version string to parse |
|  | *defaultValue* | The value to return when parsing fails |

#### Returns

| Type | Description |
| --- | --- |
|  | A file version instance or `null`. |

### smallerThan(otherVersion)

Compares if the current instance is smaller than the specified version.

#### Declaration

```csharp
function smallerThan(otherVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *otherVersion* | The version to compare the current instance to |

#### Returns

| Type | Description |
| --- | --- |
|  | A boolean with the result. |

### smallerThanOrEqual(otherVersion)

Compares if the current instance is smaller or equal than the specified version.

#### Declaration

```csharp
function smallerThanOrEqual(otherVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *otherVersion* | The version to compare the current instance to |

#### Returns

| Type | Description |
| --- | --- |
|  | A boolean with the result. |

### greaterThan(otherVersion)

Compares if the current instance is greater than the specified version.

#### Declaration

```csharp
function greaterThan(otherVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *otherVersion* | The version to compare the current instance to |

#### Returns

| Type | Description |
| --- | --- |
|  | A boolean with the result. |

### greaterThanOrEqual(otherVersion)

Compares if the current instance is greater or equal than the specified version.

#### Declaration

```csharp
function greaterThanOrEqual(otherVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *otherVersion* | The version to compare the current instance to |

#### Returns

| Type | Description |
| --- | --- |
|  | A boolean with the result. |

### equals(otherVersion)

Compares if the current instance equals (by values) the specified file.

#### Declaration

```csharp
function equals(otherVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *otherVersion* | The version to compare the current instance to |

#### Returns

| Type | Description |
| --- | --- |
|  | A boolean with the result. |

### compareTo(otherVersion)

Compare the current instance with the specified file.

#### Declaration

```csharp
function compareTo(otherVersion)
```

#### Parameters

| Type | Name | Description |
| --- | --- | --- |
|  | *otherVersion* | The version to compare the current instance to |

#### Returns

| Type | Description |
| --- | --- |
|  | 0 when the versions are equal,. 1 when the current instance is greater, -1 when the current instance is smaller |

### toString()

Gets the file version string representation for this instance.

#### Declaration

```csharp
function toString()
```
