Sample code for 30+ languages & platforms
Objective-C

bz2 Compress File

Compress a file to the bz2 file format.

Chilkat Objective-C Downloads

Objective-C
#import <CkoBz2.h>

BOOL success = NO;

//  This example requires the Chilkat API to have been previously unlocked.
//  See Global Unlock Sample for sample code.

CkoBz2 *bz2 = [[CkoBz2 alloc] init];

//  Compress the file qa_data/hamlet.xml to create qa_output/hamlet.bz2
success = [bz2 CompressFile: @"qa_data/hamlet.xml" toPath: @"qa_output/hamlet.bz2"];
if (success != YES) {
    NSLog(@"%@",bz2.LastErrorText);
    return;
}

NSLog(@"%@",@"Success.");