Method WriteAllBytesAsync
WriteAllBytesAsync(string, ReadOnlyMemory<byte>, CancellationToken)
Writes bytes to a remote file, creating it or replacing its contents, as
WriteAllBytesAsync(string, byte[], CancellationToken) does locally, with many writes in flight.
public Task WriteAllBytesAsync(string path, ReadOnlyMemory<byte> bytes, CancellationToken cancellationToken = default)
Parameters
pathstringbytesReadOnlyMemory<byte>cancellationTokenCancellationToken
Returns
Remarks
The file is truncated first, so a failure part way leaves it partly written. Where readers must never see that, write to a
temporary name and RenameAsync(string, string, bool, CancellationToken) it over the file with overwrite: true.