# OpcFile Class

> Reference: Provides static (Shared in Visual Basic) methods for opening of a single file and aids in the creation of OpcFileStream objects.

<span class="api-meta">static</span>

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

Provides static (Shared in Visual Basic) methods for opening of a single file and aids in the creation of [OpcFileStream](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfilestream/) objects.

## Syntax

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

```csharp
public static class OpcFile
```

</div>

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

```vbnet
Public Module OpcFile
```

</div>

## Inheritance

[Object](https://learn.microsoft.com/dotnet/api/system.object) → **OpcFile**

## Methods

| Name | Description |
|---|---|
| [AppendAllLines](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#appendalllines)<span class="api-meta">static · 3 overloads</span> | Appends lines to a file maintained by the file node specified by `fileNodeId` and then closes the file. |
| [AppendAllText](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#appendalltext)<span class="api-meta">static · 2 overloads</span> | Appends the specified string to the file maintained by the file node specified by `fileNodeId` and then closes the file. |
| [AppendText](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#appendtext)<span class="api-meta">static · 2 overloads</span> | Creates a [StreamWriter](https://learn.microsoft.com/dotnet/api/system.io.streamwriter) that appends UTF8 encoded text to the file maintained by the file node specified by `fileNodeId`. |
| [Open](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#open)<span class="api-meta">static</span> | Opens a file in the specified `mode`. |
| [OpenRead](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#openread)<span class="api-meta">static</span> | Creates a read-only [OpcFileStream](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfilestream/). |
| [OpenText](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#opentext)<span class="api-meta">static</span> | Creates a [StreamReader](https://learn.microsoft.com/dotnet/api/system.io.streamreader) with UTF8 encoding. |
| [OpenWrite](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#openwrite)<span class="api-meta">static</span> | Creates a write-only [OpcFileStream](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfilestream/). |
| [ReadAllBytes](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#readallbytes)<span class="api-meta">static</span> | Opens a binary file node, reads the contents of the file node into a byte array, and then closes the file node. |
| [ReadAllLines](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#readalllines)<span class="api-meta">static · 2 overloads</span> | Opens a text file node, reads all lines of the file maintained by the file node, and then closes the file node. |
| [ReadAllText](https://www.traeger.de/en/docs/development/opcua/api/v2.59/opc.uafx.client.opcfile/members#readalltext)<span class="api-meta">static · 2 overloads</span> | Opens a file node, reads all lines of the file maintained by the file node, and then closes the file node. |

## Applies to

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