-
-
Notifications
You must be signed in to change notification settings - Fork 72
FTP Storage
To use this, you need to reference FluentStorage.FTP package first, which wraps FluentFTP.
You can use this package to connect to FTP and FTPS servers.
The provider respects folder structure of the remote FTP share.
You can instantiate it either by using a simple helper method accepting the most basic parameters, like hostname, username and password, however for custom scenarios you can always construct your own instance of FtpClient from the FluentFTP library and pass it to FluentStorage to manage:
IStore store = FtpStorage.FromCredentials("myhost.com", new NetworkCredential("username", "password"));
// specify a custom ftp port (12345) as an example, real world scenarios may need extra customisations
var client = new FtpClient("myhost.com", 12345, new NetworkCredential("username", "password"));
IStore store = FtpStorage.FromClient(client);To create from connection string, first register the module when your program starts by calling StorageFactory.Modules.UseFtpStorage(); then use the following connections tring:
IStore store = StorageFactory.FromConnectionString("ftp://host=hostname;user=username;password=password");Use our simple polycloud API to perform file and object manipulation operations.
FTP has special handling for:
-
GetServer- Returns all possible FTP server metadata -
GetObjectChecksum- Fast implementation which computes a server-side checksum of the file using native FTP commands -
DownloadDirectory- Uses the FluentFTP implementation which handles all complexities internally -
UploadDirectory- Uses the FluentFTP implementation which handles all complexities internally -
ListDirectory- Correctly lists files based on the given filters -
ListObjects- Correctly lists files