I read a little about GZipStreamand method Write. What I'm trying to do is convert the compressed data from a stream and put it in an array of bytes. I will leave you with my code below, as I believe this will help significantly.
public static void Compress(byte[] fi)
{
using (MemoryStream inFile = new MemoryStream(fi))
using (FileStream outFile = File.Create(@"C:\Compressed.exe"))
using (GZipStream Compress = new GZipStream(outFile, CompressionMode.Compress))
{
inFile.CopyTo(Compress);
}
}
Instead of writing to a file on my disk, I would like to write the compressed data to an array of bytes, and then return an array of bytes (suppose I made this a function, of course).
user725913
source
share