Table of Contents

Method WriteAllBytesAsync

Namespace
SshSharp.Sftp
Assembly
SshSharp.dll

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

path string
bytes ReadOnlyMemory<byte>
cancellationToken CancellationToken

Returns

Task

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.