Hello,
I'm trying to use deflate/gzip streams in C# but it appears that the files after compression are bigger than before.
For example, I compress a docx file of 900ko, but it produce a 1.4Mo one !
And it does it for every file I tried.
May be I am wrong in the way I'm doing it? Here is my code :
FileStream input = File.OpenRead(Environment.CurrentDirectory + "/file.docx");
FileStream output = File.OpenWrite(Environment.CurrentDirectory + "/compressedfile.dat");
GZipStream comp = new GZipStream(output, CompressionMode.Compress);
while (input.Position != input.Length)
comp.WriteByte((byte)input.ReadByte());
input.Close();
comp.Close(); // automatically call flush at closing
output.Close();