concatenate-streams

Dec 15, 2010 at 12:56 PM

Hi,

I hope it's just a momentary blindness, but I can't get it.

I need to upload files (large files also) using an Upload(Stream) interface, it's quite simple with:

client.UploadStream(File.OpenRead(filePath))

Now, before upload I have to compress and encrypt the file / stream. The only way I can find is:

System.IO.Stream stream = new MemoryStream();
SevenZipCompressor zz = new SevenZipCompressor();
zz.CompressStream(File.OpenRead(filePath), stream);
stream.Flush();
stream.Seek(0, SeekOrigin.Begin);
client.UploadStream(stream);

but this loads the whole file in memory. Is any other way? something like Upload(Compress(File.OpenRead(....   ?

Thanks