Quantcast
Channel: sshnet Discussions Rss Feed
Viewing all articles
Browse latest Browse all 1729

New Post: SftpClient FileUpload asynchronous version

$
0
0
There is no direct asynchronous file upload method. They may have support in future. In the meantime you may use this extension method. It worked for me. :)
public static class SftpClientExtension
{
public static async Task UploadFileAsync(this SftpClient client, Stream input, string path, Action<ulong> uploadCallback = null)
    {
        await Task.Factory.FromAsync(client.BeginUploadFile(input, path, null, null, uploadCallback), client.EndUploadFile);
    }
}

Viewing all articles
Browse latest Browse all 1729

Trending Articles