---
product: Chilkat
product_version: 11.7.0
language: delphidll
language_label: Delphi DLL
class: Compression
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/dd_CkCompressionRef.html
---
# Chilkat Compression — Delphi DLL — v11.7.0

> Chilkat 11.7.0 · language=delphidll · class=Compression
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/Compression.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/guide.md`.

## Purpose

**Compress and decompress bytes, text, files, and streams with a flexible API.**

`Chilkat.Compression` provides a general-purpose API for compressing and decompressing data in memory, files, and streams. It supports multiple algorithms, text charset conversion, encoded output, chunked processing, and streaming operations for large data.

**Multiple algorithms**

Supports `deflate`, `zlib`, `bzip2`, and `lzw`.

**Flexible data types**

Work with byte arrays, strings, `BinData`, `StringBuilder`, files, and streams.

**Chunked processing**

Process data incrementally with `FirstChunk` and `LastChunk` for chunk-aware methods.

**Encoded output**

Return compressed bytes as text using encodings such as `base64`, `hex`, and others.

**Streaming support**

Compress or decompress large files and streams with stable memory usage.

**Compression + encryption**

Combine compression and encryption in file workflows with integrated methods.

**Tip:** For text compression, explicitly set `Charset = "utf-8"` unless another encoding is required. For encoded compressed data, set `EncodingMode` to the desired output format.

For an extended overview, see [Compression Class Overview](https://www.chilkatsoft.com/compression_class_overview.asp). See also [Binary Encodings](https://www.chilkatsoft.com/binary_encodings.asp) for supported encoded output formats.

## Object creation, unlocking and error handling

**Create/Dispose**

```pascal
var
myObject: HCkCompression;

begin
myObject := CkCompression_Create();

// ...

CkCompression_Dispose(myObject);
end;
```

`function CkCompression_Create: HCkCompression; stdcall;`

Creates an instance of the HCkCompression object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

`procedure CkCompression_Dispose(handle: HCkCompression); stdcall;`

Objects created by calling CkCompression_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in Delphi DLL.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `procedure CkCompression_getDebugLogFilePath(objHandle: HCkCompression; outPropVal: HCkString); stdcall; procedure CkCompression_putDebugLogFilePath(objHandle: HCkCompression; newPropVal: PWideChar); stdcall; function CkCompression__debugLogFilePath(objHandle: HCkCompression): PWideChar; stdcall;` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `procedure CkCompression_getLastErrorHtml(objHandle: HCkCompression; outPropVal: HCkString); stdcall; function CkCompression__lastErrorHtml(objHandle: HCkCompression): PWideChar; stdcall;` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `procedure CkCompression_getLastErrorText(objHandle: HCkCompression; outPropVal: HCkString); stdcall; function CkCompression__lastErrorText(objHandle: HCkCompression): PWideChar; stdcall;` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `procedure CkCompression_getLastErrorXml(objHandle: HCkCompression; outPropVal: HCkString); stdcall; function CkCompression__lastErrorXml(objHandle: HCkCompression): PWideChar; stdcall;` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `function CkCompression_getLastMethodSuccess(objHandle: HCkCompression): wordbool; stdcall; procedure CkCompression_putLastMethodSuccess(objHandle: HCkCompression; newPropVal: wordbool); stdcall;` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `VerboseLogging` | `function CkCompression_getVerboseLogging(objHandle: HCkCompression): wordbool; stdcall; procedure CkCompression_putVerboseLogging(objHandle: HCkCompression; newPropVal: wordbool); stdcall;` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `procedure CkCompression_getVersion(objHandle: HCkCompression; outPropVal: HCkString); stdcall; function CkCompression__version(objHandle: HCkCompression): PWideChar; stdcall;` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `Algorithm` | property, read/write | `procedure CkCompression_getAlgorithm(objHandle: HCkCompression; outPropVal: HCkString); stdcall; procedure CkCompression_putAlgorithm(objHandle: HCkCompression; newPropVal: PWideChar); stdcall; function CkCompression__algorithm(objHandle: HCkCompression): PWideChar; stdcall;` |
| `Charset` | property, read/write | `procedure CkCompression_getCharset(objHandle: HCkCompression; outPropVal: HCkString); stdcall; procedure CkCompression_putCharset(objHandle: HCkCompression; newPropVal: PWideChar); stdcall; function CkCompression__charset(objHandle: HCkCompression): PWideChar; stdcall;` |
| `DeflateLevel` | property, read/write | `function CkCompression_getDeflateLevel(objHandle: HCkCompression): Integer; stdcall; procedure CkCompression_putDeflateLevel(objHandle: HCkCompression; newPropVal: Integer); stdcall;` |
| `EncodingMode` | property, read/write | `procedure CkCompression_getEncodingMode(objHandle: HCkCompression; outPropVal: HCkString); stdcall; procedure CkCompression_putEncodingMode(objHandle: HCkCompression; newPropVal: PWideChar); stdcall; function CkCompression__encodingMode(objHandle: HCkCompression): PWideChar; stdcall;` |
| `FirstChunk` | property, read/write | `function CkCompression_getFirstChunk(objHandle: HCkCompression): wordbool; stdcall; procedure CkCompression_putFirstChunk(objHandle: HCkCompression; newPropVal: wordbool); stdcall;` |
| `HeartbeatMs` | property, read/write | `function CkCompression_getHeartbeatMs(objHandle: HCkCompression): Integer; stdcall; procedure CkCompression_putHeartbeatMs(objHandle: HCkCompression; newPropVal: Integer); stdcall;` |
| `LastChunk` | property, read/write | `function CkCompression_getLastChunk(objHandle: HCkCompression): wordbool; stdcall; procedure CkCompression_putLastChunk(objHandle: HCkCompression; newPropVal: wordbool); stdcall;` |
| `UncommonOptions` | property, read/write | `procedure CkCompression_getUncommonOptions(objHandle: HCkCompression; outPropVal: HCkString); stdcall; procedure CkCompression_putUncommonOptions(objHandle: HCkCompression; newPropVal: PWideChar); stdcall; function CkCompression__uncommonOptions(objHandle: HCkCompression): PWideChar; stdcall;` |
| `CompressBd` | method | `function CkCompression_CompressBd(objHandle: HCkCompression;     bd: HCkBinData): wordbool; stdcall;` |
| `CompressBd2` | method | `function CkCompression_CompressBd2(objHandle: HCkCompression;     bdIn: HCkBinData;     bdOut: HCkBinData): wordbool; stdcall;` |
| `CompressEncryptFile` | method | `function CkCompression_CompressEncryptFile(objHandle: HCkCompression;     cryptParams: HCkJsonObject;     srcPath: PWideChar;     destPath: PWideChar): wordbool; stdcall;` |
| `CompressFile` | method | `function CkCompression_CompressFile(objHandle: HCkCompression;     srcPath: PWideChar;     destPath: PWideChar): wordbool; stdcall;` |
| `CompressSb` | method | `function CkCompression_CompressSb(objHandle: HCkCompression;     sb: HCkStringBuilder;     binData: HCkBinData): wordbool; stdcall;` |
| `CompressStream` | method | `function CkCompression_CompressStream(objHandle: HCkCompression;     strm: HCkStream): wordbool; stdcall;` |
| `CompressStringENC` | method | `function CkCompression_CompressStringENC(objHandle: HCkCompression;     str: PWideChar;     outStr: HCkString): wordbool; stdcall; function CkCompression__compressStringENC(objHandle: HCkCompression;     str: PWideChar): PWideChar; stdcall;` |
| `DecompressBd` | method | `function CkCompression_DecompressBd(objHandle: HCkCompression;     bd: HCkBinData): wordbool; stdcall;` |
| `DecompressBd2` | method | `function CkCompression_DecompressBd2(objHandle: HCkCompression;     bdIn: HCkBinData;     bdOut: HCkBinData): wordbool; stdcall;` |
| `DecompressFile` | method | `function CkCompression_DecompressFile(objHandle: HCkCompression;     srcPath: PWideChar;     destPath: PWideChar): wordbool; stdcall;` |
| `DecompressSb` | method | `function CkCompression_DecompressSb(objHandle: HCkCompression;     binData: HCkBinData;     sb: HCkStringBuilder): wordbool; stdcall;` |
| `DecompressStream` | method | `function CkCompression_DecompressStream(objHandle: HCkCompression;     strm: HCkStream): wordbool; stdcall;` |
| `DecompressStringENC` | method | `function CkCompression_DecompressStringENC(objHandle: HCkCompression;     encodedCompressedData: PWideChar;     outStr: HCkString): wordbool; stdcall; function CkCompression__decompressStringENC(objHandle: HCkCompression;     encodedCompressedData: PWideChar): PWideChar; stdcall;` |
| `DecryptDecompressFile` | method | `function CkCompression_DecryptDecompressFile(objHandle: HCkCompression;     cryptParams: HCkJsonObject;     srcPath: PWideChar;     destPath: PWideChar): wordbool; stdcall;` |
| `LoadTaskCaller` | method | `function CkCompression_LoadTaskCaller(objHandle: HCkCompression;     task: HCkTask): wordbool; stdcall;` |

Deprecated members are listed at the end of this file with their replacements; do not use them in new code.

## Properties

### Compression.Algorithm

`Chilkat 11.7.0 · delphidll · Compression · Algorithm · property · read/write`

```pascal
procedure CkCompression_getAlgorithm(objHandle: HCkCompression; outPropVal: HCkString); stdcall;
procedure CkCompression_putAlgorithm(objHandle: HCkCompression; newPropVal: PWideChar); stdcall;
function CkCompression__algorithm(objHandle: HCkCompression): PWideChar; stdcall;
```

Specifies the compression algorithm to use. Supported values are `deflate`, `zlib`, `gzip`, `bzip2`, and `lzw`.

The `zlib` option is the deflate algorithm with a zlib header.

The `gzip` option (starting in v11.7.0) is the deflate algorithm in the gzip format (RFC 1952): a gzip header, the deflate data, and a trailer with the CRC-32 and size of the uncompressed data. When decompressing in one call, the CRC-32 and size are checked. Before v11.7.0, `gzip` was not recognized and was treated as `deflate`.

**Note:** `ppmd` is deprecated and should not be used. It was only available on 32-bit systems and specifically used the J variant. New applications should use one of the supported algorithms listed above.

### Compression.Charset

`Chilkat 11.7.0 · delphidll · Compression · Charset · property · read/write`

```pascal
procedure CkCompression_getCharset(objHandle: HCkCompression; outPropVal: HCkString); stdcall;
procedure CkCompression_putCharset(objHandle: HCkCompression; newPropVal: PWideChar); stdcall;
function CkCompression__charset(objHandle: HCkCompression): PWideChar; stdcall;
```

**Full documentation for this property (same in every language):** [How Character Encoding (Charset) Affects Compression and Decompression](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/how_charset_affects_compression.md) · [Full List of Character Encodings Supported by Chilkat](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Specifies the character encoding used when converting text to bytes before compression, and bytes back to text after decompression.

The current default is the computer’s ANSI charset, such as Windows-1252 on many Western Windows systems. However, most modern applications should explicitly set this property to `utf-8`.

**Recommendation:** Set `Charset = "utf-8"` unless you specifically need compatibility with another encoding.

### Compression.DeflateLevel

`Chilkat 11.7.0 · delphidll · Compression · DeflateLevel · property · read/write · since 9.5.0.73`

```pascal
function CkCompression_getDeflateLevel(objHandle: HCkCompression): Integer; stdcall;
procedure CkCompression_putDeflateLevel(objHandle: HCkCompression; newPropVal: Integer); stdcall;
```

Sets the compression level used by the `deflate` and `zlib` algorithms.

- `0` means no compression.
- `9` means maximum compression.
- The default value is `6`.

Higher values may produce smaller output but can require more processing time.

### Compression.EncodingMode

`Chilkat 11.7.0 · delphidll · Compression · EncodingMode · property · read/write`

```pascal
procedure CkCompression_getEncodingMode(objHandle: HCkCompression; outPropVal: HCkString); stdcall;
procedure CkCompression_putEncodingMode(objHandle: HCkCompression; newPropVal: PWideChar); stdcall;
function CkCompression__encodingMode(objHandle: HCkCompression): PWideChar; stdcall;
```

**Full documentation for this property (same in every language):** [Binary Encodings Supported by Chilkat](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/binary_encodings.md)

Specifies the text encoding used by methods whose names end in `ENC`, such as `CompressBytesENC` and `DecompressStringENC`.

Compression methods ending in `ENC` return compressed binary data as an encoded string. Decompression methods ending in `ENC` expect the input string to use this same encoding.

Valid values include:

- `base64`
- `hex`
- `url`
- `quoted-printable`

### Compression.FirstChunk

`Chilkat 11.7.0 · delphidll · Compression · FirstChunk · property · read/write · since 11.0.0`

```pascal
function CkCompression_getFirstChunk(objHandle: HCkCompression): wordbool; stdcall;
procedure CkCompression_putFirstChunk(objHandle: HCkCompression; newPropVal: wordbool); stdcall;
```

Indicates that the next chunk-aware compression or decompression call is the first chunk in a sequence.

The default value is `True`.

When both `FirstChunk` and `LastChunk` are `True`, the method call is treated as a complete, single-call compression or decompression operation.

### Compression.HeartbeatMs

`Chilkat 11.7.0 · delphidll · Compression · HeartbeatMs · property · read/write`

```pascal
function CkCompression_getHeartbeatMs(objHandle: HCkCompression): Integer; stdcall;
procedure CkCompression_putHeartbeatMs(objHandle: HCkCompression; newPropVal: Integer); stdcall;
```

**Full documentation for this property (same in every language):** [Event Callback Examples](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/event_callback_examples.md)

Specifies the interval, in milliseconds, between `AbortCheck` event callbacks.

This allows an application to periodically check whether a long-running operation should be aborted.

The default value is `0`, which disables `AbortCheck` callbacks.

### Compression.LastChunk

`Chilkat 11.7.0 · delphidll · Compression · LastChunk · property · read/write · since 11.0.0`

```pascal
function CkCompression_getLastChunk(objHandle: HCkCompression): wordbool; stdcall;
procedure CkCompression_putLastChunk(objHandle: HCkCompression; newPropVal: wordbool); stdcall;
```

Indicates that the next chunk-aware compression or decompression call is the final chunk in a sequence.

The default value is `True`.

When both `FirstChunk` and `LastChunk` are `True`, the input is treated as the complete data set and processed in a single call.

### Compression.UncommonOptions

`Chilkat 11.7.0 · delphidll · Compression · UncommonOptions · property · read/write · since 11.0.0`

```pascal
procedure CkCompression_getUncommonOptions(objHandle: HCkCompression; outPropVal: HCkString); stdcall;
procedure CkCompression_putUncommonOptions(objHandle: HCkCompression; newPropVal: PWideChar); stdcall;
function CkCompression__uncommonOptions(objHandle: HCkCompression): PWideChar; stdcall;
```

Provides a way to enable specialized or uncommon behavior. This property normally remains empty.

It may be set to a comma-separated list of keywords.

Supported option:

- `Crypt2CompressHdr` — Duplicates the compression/decompression header behavior used by the deprecated and removed Crypt2 compression functions.

## Methods

### Compression.CompressBd

`Chilkat 11.7.0 · delphidll · Compression · CompressBd · method · since 9.5.0.66`

```pascal
function CkCompression_CompressBd(objHandle: HCkCompression;
    bd: HCkBinData): wordbool; stdcall;
```

Compresses the data contained in a `BinData` object.

The `BinData` object is modified to contain the compressed result.

This method is not `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

Async variant: `CompressBdAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.CompressBd2

`Chilkat 11.7.0 · delphidll · Compression · CompressBd2 · method · since 11.0.0`

```pascal
function CkCompression_CompressBd2(objHandle: HCkCompression;
    bdIn: HCkBinData;
    bdOut: HCkBinData): wordbool; stdcall;
```

Compresses the data in one `BinData` object and appends the compressed output to another `BinData` object.

The input `BinData` is not modified.

This method is `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

Async variant: `CompressBd2Async` — same arguments, returns a `Task` (see Async variants below).

### Compression.CompressEncryptFile

`Chilkat 11.7.0 · delphidll · Compression · CompressEncryptFile · method · since 9.5.0.99`

```pascal
function CkCompression_CompressEncryptFile(objHandle: HCkCompression;
    cryptParams: HCkJsonObject;
    srcPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;
```

Compresses and encrypts a file, writing the result to a destination file.

The compression and encryption are performed internally in streaming mode, so files of any size can be processed without loading the entire file into memory.

Returns True for success, False for failure.

Async variant: `CompressEncryptFileAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.CompressFile

`Chilkat 11.7.0 · delphidll · Compression · CompressFile · method`

```pascal
function CkCompression_CompressFile(objHandle: HCkCompression;
    srcPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;
```

Compresses a source file and writes the compressed data to a destination file.

The file is processed internally in streaming mode, allowing files of any size to be compressed with stable memory usage.

Returns True for success, False for failure.

Async variant: `CompressFileAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.CompressSb

`Chilkat 11.7.0 · delphidll · Compression · CompressSb · method · since 9.5.0.73`

```pascal
function CkCompression_CompressSb(objHandle: HCkCompression;
    sb: HCkStringBuilder;
    binData: HCkBinData): wordbool; stdcall;
```

Compresses the text contained in a `StringBuilder` and appends the compressed bytes to a `BinData` object.

Text is converted to bytes according to the `Charset` property.

This method is `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

Async variant: `CompressSbAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.CompressStream

`Chilkat 11.7.0 · delphidll · Compression · CompressStream · method · since 9.5.0.56`

```pascal
function CkCompression_CompressStream(objHandle: HCkCompression;
    strm: HCkStream): wordbool; stdcall;
```

Compresses data from a stream source and writes the compressed data to the stream sink.

The operation is performed in streaming mode, making it suitable for very large or even continuous streams while maintaining stable memory usage.

Returns True for success, False for failure.

Async variant: `CompressStreamAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.CompressStringENC

`Chilkat 11.7.0 · delphidll · Compression · CompressStringENC · method`

```pascal
function CkCompression_CompressStringENC(objHandle: HCkCompression;
    str: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCompression__compressStringENC(objHandle: HCkCompression;
    str: PWideChar): PWideChar; stdcall;
```

Compresses a string and returns the compressed result as an encoded string.

The string is first converted to bytes using `Charset`, then compressed, and finally encoded according to `EncodingMode`.

This method is not `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

See the notes about [PWideChar memory ownership and validity](https://www.chilkatsoft.com/delphi_pwidechar.asp).

Async variant: `CompressStringENCAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.DecompressBd

`Chilkat 11.7.0 · delphidll · Compression · DecompressBd · method · since 9.5.0.66`

```pascal
function CkCompression_DecompressBd(objHandle: HCkCompression;
    bd: HCkBinData): wordbool; stdcall;
```

Decompresses the compressed data contained in a `BinData` object.

The `BinData` object is modified to contain the decompressed result.

This method is not `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

Async variant: `DecompressBdAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.DecompressBd2

`Chilkat 11.7.0 · delphidll · Compression · DecompressBd2 · method · since 11.0.0`

```pascal
function CkCompression_DecompressBd2(objHandle: HCkCompression;
    bdIn: HCkBinData;
    bdOut: HCkBinData): wordbool; stdcall;
```

Decompresses the data in one `BinData` object and appends the decompressed output to another `BinData` object.

The input `BinData` is not modified.

This method is `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

Async variant: `DecompressBd2Async` — same arguments, returns a `Task` (see Async variants below).

### Compression.DecompressFile

`Chilkat 11.7.0 · delphidll · Compression · DecompressFile · method`

```pascal
function CkCompression_DecompressFile(objHandle: HCkCompression;
    srcPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;
```

Decompresses a source file and writes the decompressed data to a destination file.

The file is processed internally in streaming mode, allowing files of any size to be decompressed without loading the entire file into memory.

Returns True for success, False for failure.

Async variant: `DecompressFileAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.DecompressSb

`Chilkat 11.7.0 · delphidll · Compression · DecompressSb · method · since 9.5.0.73`

```pascal
function CkCompression_DecompressSb(objHandle: HCkCompression;
    binData: HCkBinData;
    sb: HCkStringBuilder): wordbool; stdcall;
```

Decompresses compressed data from a `BinData` object and appends the resulting text to a `StringBuilder`.

The decompressed bytes are converted to text using the `Charset` property.

This method is `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

Async variant: `DecompressSbAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.DecompressStream

`Chilkat 11.7.0 · delphidll · Compression · DecompressStream · method · since 9.5.0.56`

```pascal
function CkCompression_DecompressStream(objHandle: HCkCompression;
    strm: HCkStream): wordbool; stdcall;
```

Decompresses data from a stream source and writes the decompressed data to the stream sink.

The operation is performed in streaming mode, making it suitable for very large or continuous streams while maintaining stable memory usage.

Returns True for success, False for failure.

Async variant: `DecompressStreamAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.DecompressStringENC

`Chilkat 11.7.0 · delphidll · Compression · DecompressStringENC · method`

```pascal
function CkCompression_DecompressStringENC(objHandle: HCkCompression;
    encodedCompressedData: PWideChar;
    outStr: HCkString): wordbool; stdcall;
function CkCompression__decompressStringENC(objHandle: HCkCompression;
    encodedCompressedData: PWideChar): PWideChar; stdcall;
```

Decompresses compressed data supplied as an encoded string and returns the resulting text.

The input string is decoded according to `EncodingMode`, then decompressed. The resulting bytes are converted to text using `Charset`.

This method is not `FirstChunk` / `LastChunk` aware.

Returns True for success, False for failure.

See the notes about [PWideChar memory ownership and validity](https://www.chilkatsoft.com/delphi_pwidechar.asp).

Async variant: `DecompressStringENCAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.DecryptDecompressFile

`Chilkat 11.7.0 · delphidll · Compression · DecryptDecompressFile · method · since 9.5.0.99`

```pascal
function CkCompression_DecryptDecompressFile(objHandle: HCkCompression;
    cryptParams: HCkJsonObject;
    srcPath: PWideChar;
    destPath: PWideChar): wordbool; stdcall;
```

Decrypts and decompresses a file, writing the restored data to a destination file.

This is the reverse operation of `CompressEncryptFile`.

Returns True for success, False for failure.

Async variant: `DecryptDecompressFileAsync` — same arguments, returns a `Task` (see Async variants below).

### Compression.LoadTaskCaller

`Chilkat 11.7.0 · delphidll · Compression · LoadTaskCaller · method · since 9.5.0.80`

```pascal
function CkCompression_LoadTaskCaller(objHandle: HCkCompression;
    task: HCkTask): wordbool; stdcall;
```

Loads the caller of the task's async method.

Returns True for success, False for failure.

## Events and callbacks

### Compression.AbortCheck (event)

`Chilkat 11.7.0 · delphidll · Compression · AbortCheck · event`

```pascal
function MyAbortCheck(): Integer; cdecl;
```

Enables a method call to be aborted by triggering the AbortCheck event at intervals defined by the `HeartbeatMs` property. If HeartbeatMs is set to its default value of 0, no events will occur. For instance, set HeartbeatMs to 200 to trigger 5 AbortCheck events per second. Return `True` to abort; return `False` to continue (not abort)

### Compression.PercentDone (event)

`Chilkat 11.7.0 · delphidll · Compression · PercentDone · event`

```pascal
function MyPercentDone(pctDone: Integer): Integer; cdecl;
```

This provides the percentage completion for any method involving network communications or time-consuming processing, assuming the progress can be measured as a percentage. This event is triggered only when it's possible and logical to express the operation's progress as a percentage. The `pctDone` argument will range from 1 to 100. For methods that finish quickly, the number of PercentDone callbacks may vary, but the final callback will have `pctDone` equal to 100. For longer operations, callbacks will not exceed one per percentage point (e.g., 1, 2, 3, ..., 98, 99, 100).

The PercentDone callback also acts as an `AbortCheck` event. For fast methods where PercentDone fires, an AbortCheck event may not trigger since the PercentDone callback already provides an opportunity to abort. For longer operations, where time between PercentDone callbacks is extended, AbortCheck callbacks enable more responsive operation termination.

Return `True` to abort; return `False` to continue (not abort)

### Compression.ProgressInfo (event)

`Chilkat 11.7.0 · delphidll · Compression · ProgressInfo · event`

```pascal
procedure MyProgressInfo(name: PWideChar; value: PWideChar) cdecl;
```

This event callback provides `tag name`/value pairs that detail what occurs during a method call. To discover existing tag names, create code to handle the event, emit the pairs, and review them. Most tag names are self-explanatory.

Note: Some Chilkat methods don't fire any ProgressInfo events.

### Compression.TaskCompleted (event)

`Chilkat 11.7.0 · delphidll · Compression · TaskCompleted · event`

```pascal
procedure MyTaskCompleted(task: HCkTask) cdecl;
```

Called from the background thread when an asynchronous task completes.

## Async variants

Each returns a `Task` instead of the result and takes the same arguments as the synchronous method; run the task, wait for `Finished`, then read the result from the task. No new Async methods are added from 11.7.0 on.

```pascal
function CkCompression_CompressBdAsync(objHandle: HCkCompression;
    bd: HCkBinData): HCkTask; stdcall;
function CkCompression_CompressBd2Async(objHandle: HCkCompression;
    bdIn: HCkBinData;
    bdOut: HCkBinData): HCkTask; stdcall;
function CkCompression_CompressEncryptFileAsync(objHandle: HCkCompression;
    cryptParams: HCkJsonObject;
    srcPath: PWideChar;
    destPath: PWideChar): HCkTask; stdcall;
function CkCompression_CompressFileAsync(objHandle: HCkCompression;
    srcPath: PWideChar;
    destPath: PWideChar): HCkTask; stdcall;
function CkCompression_CompressSbAsync(objHandle: HCkCompression;
    sb: HCkStringBuilder;
    binData: HCkBinData): HCkTask; stdcall;
function CkCompression_CompressStreamAsync(objHandle: HCkCompression;
    strm: HCkStream): HCkTask; stdcall;
function CkCompression_CompressStringENCAsync(objHandle: HCkCompression;
    str: PWideChar): HCkTask; stdcall;
function CkCompression_DecompressBdAsync(objHandle: HCkCompression;
    bd: HCkBinData): HCkTask; stdcall;
function CkCompression_DecompressBd2Async(objHandle: HCkCompression;
    bdIn: HCkBinData;
    bdOut: HCkBinData): HCkTask; stdcall;
function CkCompression_DecompressFileAsync(objHandle: HCkCompression;
    srcPath: PWideChar;
    destPath: PWideChar): HCkTask; stdcall;
function CkCompression_DecompressSbAsync(objHandle: HCkCompression;
    binData: HCkBinData;
    sb: HCkStringBuilder): HCkTask; stdcall;
function CkCompression_DecompressStreamAsync(objHandle: HCkCompression;
    strm: HCkStream): HCkTask; stdcall;
function CkCompression_DecompressStringENCAsync(objHandle: HCkCompression;
    encodedCompressedData: PWideChar): HCkTask; stdcall;
function CkCompression_DecryptDecompressFileAsync(objHandle: HCkCompression;
    cryptParams: HCkJsonObject;
    srcPath: PWideChar;
    destPath: PWideChar): HCkTask; stdcall;
```

## Deprecated members — do not use in new code

| Member | Kind | Deprecated in | Use instead |
|---|---|---|---|
| `BeginCompressBytes` | method | before 11.6.1 | `FirstChunk` |
| `BeginCompressBytesENC` | method | before 11.6.1 | — |
| `BeginCompressString` | method | before 11.6.1 | `FirstChunk` |
| `BeginCompressStringENC` | method | before 11.6.1 | `FirstChunk` |
| `BeginDecompressBytes` | method | before 11.6.1 | `FirstChunk` |
| `BeginDecompressBytesENC` | method | before 11.6.1 | `FirstChunk` |
| `BeginDecompressString` | method | before 11.6.1 | `FirstChunk` |
| `BeginDecompressStringENC` | method | before 11.6.1 | `FirstChunk` |
| `CompressBytes` | method | before 11.6.1 | — |
| `CompressBytesENC` | method | before 11.6.1 | — |
| `CompressStr` | method | before 11.6.1 | — |
| `CompressString` | method | before 11.6.1 | — |
| `DecompressBytes` | method | before 11.6.1 | — |
| `DecompressBytesENC` | method | before 11.6.1 | — |
| `DecompressString` | method | before 11.6.1 | — |
| `EndCompressBytes` | method | before 11.6.1 | — |
| `EndCompressBytesENC` | method | before 11.6.1 | — |
| `EndCompressString` | method | before 11.6.1 | — |
| `EndCompressStringENC` | method | before 11.6.1 | — |
| `EndDecompressBytes` | method | before 11.6.1 | — |
| `EndDecompressBytesENC` | method | before 11.6.1 | — |
| `EndDecompressString` | method | before 11.6.1 | — |
| `EndDecompressStringENC` | method | before 11.6.1 | — |
| `MoreCompressBytes` | method | before 11.6.1 | — |
| `MoreCompressBytesENC` | method | before 11.6.1 | — |
| `MoreCompressString` | method | before 11.6.1 | — |
| `MoreCompressStringENC` | method | before 11.6.1 | — |
| `MoreDecompressBytes` | method | before 11.6.1 | — |
| `MoreDecompressBytesENC` | method | before 11.6.1 | — |
| `MoreDecompressString` | method | before 11.6.1 | — |
| `MoreDecompressStringENC` | method | before 11.6.1 | — |

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/classes/BinData.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/classes/JsonObject.md), [`Stream`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/classes/Stream.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/classes/StringBuilder.md), [`Task`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/delphidll/classes/Task.md)

