# GetBytesRead

> Returns the total number of bytes read by all the ReadCommand operations the asynchronous file read request.

## Definition

* **Type:** Method
* **Namespace:** [Unity.IO.LowLevel.Unsafe](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe.md)
* **Assembly:** UnityEngine.CoreModule

## GetBytesRead()

Returns the total number of bytes read by all the [ReadCommand](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand.md) operations the asynchronous file read request.

```csharp
public long GetBytesRead()
```

### Returns

| Type                                                        | Description                                                           |
| ----------------------------------------------------------- | --------------------------------------------------------------------- |
| [long](https://learn.microsoft.com/dotnet/api/system.int64) | The total number of bytes read by the asynchronous file read request. |

### Remarks

This may not be equal to the sum of all the requested [ReadCommand.Size](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand/size.md) fields in the case of a [ReadStatus.Failed](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readstatus/failed.md) error or a [ReadStatus.Truncated](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readstatus/truncated.md) status.

A truncated read occurs when the [ReadCommand](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand.md) describing the read operation specifies a  [ReadCommand.Size](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand/size.md) and [ReadCommand.Offset](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand/offset.md) that extends past the end of the target file.

## GetBytesRead(uint)

Returns the total number of bytes read for a specific [ReadCommand](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand.md) index.

```csharp
public long GetBytesRead(uint readCommandIndex)
```

### Parameters

**** (\[uint]\(https\://learn.microsoft.com/dotnet/api/system.uint32)): The index of the [ReadCommand](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand.md) for which to retrieve the number of bytes read.

### Returns

| Type                                                        | Description                                                                                                                        |
| ----------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| [long](https://learn.microsoft.com/dotnet/api/system.int64) | The number of bytes read for the specified [ReadCommand](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand.md). |

### Remarks

This may not be equal the requested [ReadCommand.Size](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand/size.md) fields in the case of a [ReadStatus.Failed](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readstatus/failed.md) error or a [ReadStatus.Truncated](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readstatus/truncated.md) status.

A truncated read occurs when the [ReadCommand](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand.md) describing the read operation specifies a  [ReadCommand.Size](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand/size.md) and [ReadCommand.Offset](/engine/6000.3/script-reference/unity/io/lowlevel/unsafe/readcommand/offset.md) that extends past the end of the target file.
