Streams are of course supported by FTP .NET client, both uploading from a Stream and downloading to a Stream.
Here's the sample of uploading file from a .NET stream. We use FileStream in this particular case, but any .NET Stream can by used. For example MemoryStream:
using(Ftp ftp = new Ftp())
{
ftp.ConnectSSL("ftp.example.com");
ftp.Login("user", "password");
using (Stream destination = File.Create("c:\\june2014.csv"))
{
ftp.Download("\\reports\\june2014.csv", destination);
destination.Close();
}
ftp.Close();
}
Here's the sample of downloading file from a remote FTP server directly in to .NET stream. Again we use FileStream here, but of course any .NET stream can be used.
using(Ftp ftp = new Ftp())
{
ftp.ConnectSSL("ftp.example.com");
ftp.Login("user", "password");
using (Stream source = File.OpenRead("c:\\results.csv"))
{
ftp.Upload("\\reports\\results.csv", source);
source.Close();
}
ftp.Close();
}