Table of Contents

Method ReadAllTextAsync

Namespace
SshSharp.Sftp
Assembly
SshSharp.dll

ReadAllTextAsync(string, Encoding?, CancellationToken)

Reads a whole remote file as text, as ReadAllTextAsync(string, Encoding, CancellationToken) does locally: a byte order mark, if there is one, decides the encoding; otherwise encoding (UTF-8 by default).

public Task<string> ReadAllTextAsync(string path, Encoding? encoding = null, CancellationToken cancellationToken = default)

Parameters

path string
encoding Encoding
cancellationToken CancellationToken

Returns

Task<string>

Exceptions

SftpException

The file does not exist (NoSuchFile), or another error.