JohnTheGr8 / Renci.SshNet.Async

Extends Renci.SshNet to implement the task-based async pattern
MIT License
67 stars 24 forks source link

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: