# DeviceFileSystem

Namespace: **Wisej.Hybrid**

Assembly: **Wisej.Hybrid** (3.5.0.0)

Provides methods to interact with the device's file system, allowing you to perform various file-related operations.

{% tabs %}
{% tab title="C#" %}

```csharp
public class DeviceFileSystem
```

{% endtab %}

{% tab title="VB.NET" %}

```visual-basic
Public Class DeviceFileSystem
```

{% endtab %}
{% endtabs %}

Access this class through the [FileSystem](https://docs.wisej.com/hybrid/start/general/wisej.hybrid.device#filesystem) singleton.

## Constructors

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)DeviceFileSystem()

Initializes a new instance of [DeviceFileSystem](https://docs.wisej.com/hybrid/start/api/storage/wisej.hybrid.devicefilesystem).

## Methods

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)CreateDirectory(path)

Creates a directory at the given path.

| Parameter | Type                                                          | Description                   |
| --------- | ------------------------------------------------------------- | ----------------------------- |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The directory path to create. |

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)DeleteDirectory(path)

Deletes the directory at the given path.

| Parameter | Type                                                          | Description                   |
| --------- | ------------------------------------------------------------- | ----------------------------- |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The directory path to delete. |

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)DeleteFile(path)

Deletes the file at the given path.

| Parameter | Type                                                          | Description              |
| --------- | ------------------------------------------------------------- | ------------------------ |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file path to delete. |

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)Exists(path)

Determines whether a file exists at the given path.

| Parameter | Type                                                          | Description             |
| --------- | ------------------------------------------------------------- | ----------------------- |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file path to check. |

**Returns:** [Boolean](https://docs.microsoft.com/dotnet/api/system.boolean). true if the file exists; otherwise, false.

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)GetFiles(directory)

Gets a list of file names in the specified directory.

| Parameter     | Type                                                          | Description                  |
| ------------- | ------------------------------------------------------------- | ---------------------------- |
| **directory** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The directory path to query. |

**Returns:** [String\[\]](https://docs.microsoft.com/dotnet/api/system.string). An array of file names in the directory.

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)ReadBytes(path)

Reads the bytes from a file at the given path.

| Parameter | Type                                                          | Description                 |
| --------- | ------------------------------------------------------------- | --------------------------- |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file path to read from. |

**Returns:** [Byte\[\]](https://docs.microsoft.com/dotnet/api/system.byte). An array of bytes representing the file contents.

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)ReadText(path)

Reads the text from a file at the given path.

| Parameter | Type                                                          | Description                 |
| --------- | ------------------------------------------------------------- | --------------------------- |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file path to read from. |

**Returns:** [String](https://docs.microsoft.com/dotnet/api/system.string). The text content of the file.

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)WriteBytes(path, bytes)

Writes the provided bytes to a file at the given path.

| Parameter | Type                                                          | Description                     |
| --------- | ------------------------------------------------------------- | ------------------------------- |
| **path**  | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file path to write to.      |
| **bytes** | [Byte\[\]](https://docs.microsoft.com/dotnet/api/system.byte) | The bytes to write to the file. |

### ![](https://1168517704-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FKLgWHTlbcMvpwVT7mLBW%2Fuploads%2Fgit-blob-2389c55cd19719a73a5ae98e1528c8dc8525cc35%2Finstance.png?alt=media)WriteText(path, contents)

Writes the provided text to a file at the given path.

| Parameter    | Type                                                          | Description                             |
| ------------ | ------------------------------------------------------------- | --------------------------------------- |
| **path**     | [String](https://docs.microsoft.com/dotnet/api/system.string) | The file path to write to.              |
| **contents** | [String](https://docs.microsoft.com/dotnet/api/system.string) | The text contents to write to the file. |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/hybrid/start/api/storage/wisej.hybrid.devicefilesystem.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
