Created
February 25, 2018 15:34
-
-
Save talkingdotnet/0259175fe56b2ad50e42f77ca333a35f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void PrepareZip(string filePath) | |
{ | |
FileInfo gZipfile = new FileInfo(filePath); | |
FileInfo gzipFileName = new FileInfo(string.Concat(gZipfile.FullName, ".gz")); | |
using (FileStream fileToBeZippedAsStream = gZipfile.OpenRead()) | |
{ | |
using (FileStream gzipTargetAsStream = gzipFileName.Create()) | |
{ | |
using (GZipStream gzipStream = new GZipStream(gzipTargetAsStream, CompressionMode.Compress)) | |
{ | |
try | |
{ | |
fileToBeZippedAsStream.CopyTo(gzipStream); | |
} | |
catch (Exception ex) { throw ex; } | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment