its a two line solution, you just need to copy the compressionstream to a filestream.
using (FileStream outFile = new FileStream(sOutFilePath, FileMode.Create, FileAccess.Write, FileShare.None))
CopyStream(compressionStream, outFile);
Ok you need to make sure you are at the beginning of the compressionStream so adding
compressionStream.Seek(0, SeekOrigin.Begin);
could be necessary.
EDIT:
Sorry so the implementation of copyTo should be something like this:
public void CopyStream(Stream source, Stream destination, int bufferSize = 81920)
{
byte[] buffer = new byte[bufferSize];
int read;
while ((read = source.Read(buffer, 0, buffer.Length)) != 0)
destination.Write(buffer, 0, read);
}
EDIT2:
the default bufferSize in the .Net4.5 implementation is defined as follows:
private const int _DefaultCopyBufferSize = 81920;
Full Source at referencesource.microsoft.com