Method GetFileAsync
Namespace: Belay.Core
Assembly: Belay.Core.dll
GetFileAsync(string, CancellationToken)
Reads a file from the device using adaptive chunked transfer. Automatically optimizes chunk size based on device communication performance. Based on official mpremote fs_readfile implementation with base64 encoding.
csharp
public Task<byte[]> GetFileAsync(string remotePath, CancellationToken cancellationToken = default)Parameters
remotePath string
Remote file path on device.
cancellationToken CancellationToken
Cancellation token.
Returns
The file contents.
Exceptions
Thrown when remotePath is null, empty, or contains invalid characters.
Thrown when device communication fails or file operation fails.
Thrown when the operation is canceled.