I have a gzipstream that is compressed and I want to write it to a file. Now the problem is that the Read is not supported on the gzipstream that is compressed. Below is my code where the gzipstream reads the stream from a memorystream and then I want to write it to a filestream.
using (var stream = new MemoryStream())
{
using (FileStream file = new FileStream(@"c:\newest.xml.gz",
FileMode.Create, FileAccess.Write))
{
using (GZipStream gzs = new GZipStream(file, CompressionLevel.Fastest))
{
stream.CopyTo(gzs);
}
}
}
Any idea how I can create a filestream from a compressed gzipstream?
EDIT:
That was my bad, sorry to have waste your time. For future reference the code above should work, the problem was somewhere else.