Net Encryption Library
Compressing Files
Basic Tasks > Compressing Files

Compression Files Overview

The .NET Encryption Library supports compression with GZip, Deflate, and MiniLZO.

 

C#
Encryption encryption = new Encryption(); //Trial Mode
//Encryption encryption = new Encryption("place user name here", "place license key here"); //License Mode
 
StringBuilder sb = new StringBuilder();
for (int i = 0; i < 1024; i++)
    sb.AppendLine("This is a test");
 
File.WriteAllText("input.txt", sb.ToString());
 
encryption.CompressFile(CompressionType.MiniLZO, "input.txt", "compressed.txt");
encryption.DecompressFile(CompressionType.MiniLZO, "compressed.txt", "decompressed.txt");

VB.NET
Dim encryption As New Encryption() 'Trial Mode
'Dim encryption As New Encryption("place user name here", "place license key here") 'License Mode
 
Dim sb As New StringBuilder()
For i As Integer = 0 To 1023
    sb.AppendLine("This is a test")
Next i
 
File.WriteAllText("input.txt", sb.ToString())
 
encryption.CompressFile(CompressionType.MiniLZO, "input.txt", "compressed.txt")
encryption.DecompressFile(CompressionType.MiniLZO, "compressed.txt", "decompressed.txt")