.NET Core C#
.NET Core C#
Compress Bytes
See more Compression Examples
Demonstrates how to compress binary data.Chilkat .NET Core C# Downloads
bool success = false;
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
Chilkat.FileAccess fac = new Chilkat.FileAccess();
byte[] fileBytes = null;
fileBytes = fac.ReadEntireFile("qa_data/bmp/big.bmp");
if (fac.LastMethodSuccess != true) {
Debug.WriteLine(fac.LastErrorText);
return;
}
Chilkat.Compression compress = new Chilkat.Compression();
compress.Algorithm = "deflate";
byte[] compressedBytes = null;
compressedBytes = compress.CompressBytes(fileBytes);
if (compress.LastMethodSuccess != true) {
Debug.WriteLine(compress.LastErrorText);
return;
}
success = fac.WriteEntireFile("qa_output/compressedBmp.dat",compressedBytes);
if (fac.LastMethodSuccess != true) {
Debug.WriteLine(fac.LastErrorText);
return;
}