Yes, it is very easy using Rebex components:
// prepare input data
var inputStream = new MemoryStream(Encoding.ASCII.GetBytes("This is test data."));
// prepare ZIP stream
var zipStream = new MemoryStream();
using (var zip = new ZipArchive(zipStream, ArchiveStreamCloseMode.LeaveOpen))
{
// set password
zip.Password = "top-secret";
// add input data
zip.AddFile(inputStream, "data.txt");
}
// connect to SFTP and log in
var client = new Sftp();
client.Connect(sftpHost, sftpPort);
client.Login(sftpUser, sftpPassword);
// upload ZIP stream (from the beginning)
zipStream.Position = 0;
client.PutFile(zipStream, "/data/secret.zip");
All is done in memory, without need to create any temporary file on disk.