Skip to content

Foundatio.Storage.SshNet

Foundatio provides SFTP-based file storage via SSH.NET. View source on GitHub →

Overview

ImplementationInterfacePackage
SshNetFileStorageIFileStorageFoundatio.Storage.SshNet

Installation

bash
dotnet add package Foundatio.Storage.SshNet

Usage

csharp
using Foundatio.Storage;

var storage = new SshNetFileStorage(o =>
    o.ConnectionString = "host=sftp.example.com;username=user;password=pass;path=/uploads");

await storage.SaveFileAsync("documents/report.pdf", pdfStream);
var stream = await storage.GetFileStreamAsync("documents/report.pdf");

Configuration

OptionTypeRequiredDescription
ConnectionStringstringConnection string
PrivateKeyStreamPrivate key for authentication
PrivateKeyPassPhrasestringPrivate key passphrase
ProxystringProxy server
ProxyTypeProxyTypesProxy type

For additional options, see SshNetFileStorageOptions source.

Next Steps

Released under the Apache 2.0 License.