Table of Contents

Method DownloadFileAsync

Namespace
SshSharp.Sftp
Assembly
SshSharp.dll

DownloadFileAsync(string, string, SftpTransferOptions?, CancellationToken)

Downloads remotePath to the local file localPath. With Overwrite off, an existing local file is an error; with Preserve, the local file gets the remote one's modification and access times, and its permissions where this system has Unix modes. A failed download leaves no partial file behind.

public Task<long> DownloadFileAsync(string remotePath, string localPath, SftpTransferOptions? options = null, CancellationToken cancellationToken = default)

Parameters

remotePath string
localPath string
options SftpTransferOptions
cancellationToken CancellationToken

Returns

Task<long>

The number of bytes downloaded.