Dart
Dart
Decompress Bytes
See more Compression Examples
Demonstrates how to decompress binary data.Chilkat Dart Downloads
import 'package:chilkat/chilkat.dart';
void main() {
// This example requires the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
// See this example to compress bytes: Compress Bytes
final fac = CkFileAccess();
final compressedBytes = fac.readEntireFile('qa_data/compressed/compressedBmp.dat');
if (!fac.lastMethodSuccess) {
print(fac.lastErrorText);
return;
}
final compress = CkCompression();
compress.algorithm = 'deflate';
final decompressedBytes = compress.decompressBytes(compressedBytes);
if (!compress.lastMethodSuccess) {
print(compress.lastErrorText);
return;
}
try {
fac.writeEntireFile('qa_output/decompressed.bmp', decompressedBytes);
} on ChilkatException catch (e) {
print(e.lastErrorText);
return;
}
}