Guest User

C# GZ Uncompression

a guest
May 5th, 2017
28
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.66 KB | None | 0 0
  1. /// <summary>
  2.         /// Uncompresses a gz file.
  3.         /// </summary>
  4.         /// <param name="filePath">The file path.</param>
  5.         /// <param name="memStream">The memory stream.</param>
  6.         void UncompressGzFile(string filePath, ref MemoryStream memStream) {
  7.             using (var fStream = new FileStream(filePath, FileMode.Open))
  8.             using (var zipStream = new GZipStream(fStream, CompressionMode.Decompress, false)) {
  9.                 zipStream.CopyTo(memStream = new MemoryStream());
  10.                 memStream.Position = 0; // Set position to beginning to prevent weird errors from happening throughout the application.
  11.             }
  12.         }
Advertisement
Add Comment
Please, Sign In to add comment