# OpcFileMode Enum

<dl class="api-definition">
<dt>Namespace</dt>
<dd><a href="../namespaces/opc.uafx">Opc.UaFx</a></dd>
<dt>Assembly</dt>
<dd>Opc.UaFx.Advanced.dll</dd>
<dt>Package</dt>
<dd>Opc.UaFx.Advanced v2.59.0</dd>
<dt>Also in</dt>
<dd>Opc.UaFx.Client</dd>
</dl>

Defines the type of access and how the system should open an existing file.

## Syntax

<div class="api-signature" data-lang="csharp">

```csharp
public enum OpcFileMode : byte
```

</div>

<div class="api-signature" data-lang="vbnet">

```vbnet
<Flags>
Public Enum OpcFileMode As Byte
```

</div>

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → [ValueType](https://learn.microsoft.com/dotnet/api/system.valuetype) → [Enum](https://learn.microsoft.com/dotnet/api/system.enum) → **OpcFileMode**

## Fields

| Name | Value | Description |
|---|---|---|
| <a id="append"></a>`Append` | `8` | Specifies that an existing file is to be opened at the end of the file; otherwise at the beginning of the file. Combine with [Write](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#write) to continue with write access. To continue with read access combine with [Read](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#read), this requires to manually seek to a position before the end of the file before reading. |
| <a id="appendread"></a>`AppendRead` | `Read \| Append` | Specifies that an existing file is to be opened at the end of the file for reading. This options combines the options [Append](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#append) and [Read](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#read). Combine with [Write](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#write) for read/write access. This requires to manually seek to a position before the end of the file before reading. |
| <a id="appendwrite"></a>`AppendWrite` | `Write \| Append` | Specifies that an existing file is to be opened at the end of the file for writing. This option combines the options [Append](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#append) and [Write](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#write). Combine with [Read](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#read) for read/write access. |
| <a id="eraseexisting"></a>`EraseExisting` | `4` | Specifies that an existing file is to be opened and its content is to be erased so that its size is zero bytes. This option requires the option [Write](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#write). |
| <a id="read"></a>`Read` | `1` | Specifies that an existing file is to be opened for reading. Combine with [Write](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#write) for read/write access. |
| <a id="readwrite"></a>`ReadWrite` | `Read \| Write` | Specifies that an existing file is to be opened for reading and writing. |
| <a id="truncate"></a>`Truncate` | `Write \| EraseExisting` | Specifies that an existing file is to be opened and its content is to be erased so that its size is zero bytes. This option combines the options [EraseExisting](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#eraseexisting) and [Write](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#write). |
| <a id="write"></a>`Write` | `2` | Specifies that an existing file is to be opened for writing. Combine with [Read](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.opcfilemode/#read) for read/write access. |

## Applies to

| Package | Versions |
|---|---|
| Opc.UaFx.Advanced | v2.5–v2.59 |
