Saturday, September 6, 2014

Store bytes conent to zip file in C#



You can store bytes in zip using the GZipStream object.

 
public static void CreateZipFromBytes(string fileName, byte[] bytesToCompress)

        {

            using (FileStream fileToCompress = File.Create(fileName))

            {

                using (GZipStream compressionStream = new GZipStream(fileToCompress, CompressionMode.Compress))

                {

                    compressionStream.Write(bytesToCompress, 0, bytesToCompress.Length);

                }

            }

        }

1 comment:

  1. You have hit the nail! I was once a desperate homemaker not confident enough to stand up to the world. I am a good one though. I can sew, knit, cook, and take tuitions (for my children). But making money out of…I have never dreamt of. One day I came across www.gricree.com and that changed my life. I am now selling my teaching skills by recording syllabus for fifth to eighth graders, and people have bought my video. I still cannot believe it. Want to make money like me? Check out buy yelp accounts,excellent invitation flyerstoo. You can earn for whatever you can do. The sky is the limit.

    ReplyDelete