Skip to content

Method ReadTextFileAsync

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

ReadTextFileAsync(string, CancellationToken)

Reads the entire contents of a text file from the device.

csharp
public Task<string> ReadTextFileAsync(string path, CancellationToken cancellationToken = default)

Parameters

path string

The file path to read.

cancellationToken CancellationToken

Cancellation token to cancel the operation.

Returns

Task<string>

The file contents as a string.

Exceptions

FileNotFoundException

Thrown when the file does not exist.

UnauthorizedAccessException

Thrown when access is denied.

Released under the Apache License 2.0.