Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. FileInfo fi = new FileInfo(fullpath);
  2. String b64ZippedData = String.Empty;
  3. using (FileStream filestream = fi.OpenRead()) // source
  4. {
  5. using (MemoryStream memorystream = new MemoryStream()) // destination
  6. {
  7. using (GZipStream gzipstream = new GZipStream(memorystream, CompressionMode.Compress, false)) // compression engine
  8. {
  9. filestream.CopyTo(gzipstream);
  10. }
  11. b64ZippedData = System.Convert.ToBase64String(memorystream.ToArray());
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement