Skip to content

Method ReadFileAsync

Namespace: Belay.Sync
Assembly: Belay.Sync.dll

ReadFileAsync(string, CancellationToken)

Reads the entire contents of a file from the device.

csharp
public Task<byte[]> ReadFileAsync(string path, CancellationToken cancellationToken = default)

Parameters

path string

The file path to read.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<byte[]>

The file contents as a byte array.

Exceptions

FileNotFoundException

Thrown when the file does not exist.

UnauthorizedAccessException

Thrown when access is denied.

Released under the Apache License 2.0.