Skip to content

Extends Renci.SshNet to implement the task-based async pattern

License

Notifications You must be signed in to change notification settings

JohnTheGr8/Renci.SshNet.Async

Repository files navigation

Renci.SshNet.Async Build status NuGet Nuget

About

A collection of extensions for SSH.NET that implement the Task-based Asynchronous Pattern from the originally implemented Asynchronous Programming Model

Install

You can install Renci.SshNet.Async from Nuget:

PM> Install-Package Renci.SshNet.Async

Usage

The code sample below demonstrates how the extension methods are used.

// initialize client and connect like you normally would
var client = new SftpClient("host", "username", "password");
client.Connect();

// await a directory listing
var listing = await client.ListDirectoryAsync(".");

// await a file upload
using (var localStream = File.OpenRead("path_to_local_file"))
{
    await client.UploadAsync(localStream, "upload_path");
}

// disconnect like you normally would
client.Disconnect();

Supported Operations

Not all operations expose async methods in the base library. The extension methods introduced by this library are listed below:

  • SftpClient.ListDirectoryAsync
  • SftpClient.DownloadAsync
  • SftpClient.UploadAsync
  • SftpClient.SynchronizeDirectoriesAsync
  • SshCommand.ExecuteAsync

About

Extends Renci.SshNet to implement the task-based async pattern

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages