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