---
product: Chilkat
product_version: 11.7.0
language: vbnet
language_label: VB.NET
class: Gzip
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/vbnetGzipRef.html
---
# Chilkat Gzip — VB.NET — v11.7.0

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

## Purpose

**Compress, decompress, inspect, and convert GZIP data in files or memory.**

`Chilkat.Gzip` provides GZIP compression and decompression for file-based and in-memory workflows. It can compress and uncompress files, strings, byte arrays, `BinData`, and encoded data such as Base64 or hex. It also supports `.tar.gz` extraction, gzip metadata such as original filename, timestamp, and comments, and inspection of GZIP header information without fully expanding the compressed data.

**File compression**

Compress files to `.gz`, uncompress `.gz` files, and write decompressed output directly to disk.

**Memory-based data**

Work with byte arrays and `Chilkat.BinData` for applications that need compression or decompression without temporary files.

**String workflows**

Compress and uncompress strings with explicit charset handling for text data that must round-trip correctly.

**Encoded GZIP data**

Handle GZIP data represented as Base64, hex, or other supported encoded forms when binary data must be carried as text.

**GZIP metadata**

Set or inspect metadata such as original filename, modified time, comments, and extra data stored in the GZIP header.

**Tar-gzip and XFDL**

Extract `.tar.gz` archives and decode XFDL content that uses gzip-related encodings.

**Common pattern:** Use `Gzip` when the data is a single GZIP stream, a `.gz` file, or a `.tar.gz` archive. For ZIP archives, use `Chilkat.Zip`; for raw deflate or zlib-style compression, use `Chilkat.Compression`.

For an extended overview, see [Gzip Class Overview](https://www.chilkatsoft.com/gzip_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

```vbnet
Dim obj As New Chilkat.Gzip()
```

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 VB.NET.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## 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` | `DebugLogFilePath As String` | 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` | `LastErrorHtml As String (ReadOnly)` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `LastErrorText As String (ReadOnly)` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `LastErrorXml As String (ReadOnly)` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `LastMethodSuccess As Boolean` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `VerboseLogging` | `VerboseLogging As Boolean` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `Version As String (ReadOnly)` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AbortCurrent` | property, read/write | `AbortCurrent As Boolean` |
| `Comment` | property, read/write | `Comment As String` |
| `CompressionLevel` | property, read/write | `CompressionLevel As Integer` |
| `ExtraData` | property, read/write | `ExtraData As Byte()` |
| `Filename` | property, read/write | `Filename As String` |
| `HeartbeatMs` | property, read/write | `HeartbeatMs As Integer` |
| `LastModStr` | property, read/write | `LastModStr As String` |
| `UseCurrentDate` | property, read/write | `UseCurrentDate As Boolean` |
| `CompressBd` | method | `Function CompressBd(ByVal binDat As BinData) As Boolean` |
| `CompressFile` | method | `Function CompressFile(ByVal srcPath As String, ByVal destPath As String) As Boolean` |
| `CompressFile2` | method | `Function CompressFile2(ByVal srcPath As String, ByVal embeddedFilename As String, ByVal destPath As String) As Boolean` |
| `CompressFileBd` | method | `Function CompressFileBd(ByVal filePath As String, ByVal bd As BinData) As Boolean` |
| `CompressFileToMem` | method | `Function CompressFileToMem(ByVal inFilename As String) As Byte()` |
| `CompressMemory` | method | `Function CompressMemory(ByVal inData As Byte()) As Byte()` |
| `CompressMemToFile` | method | `Function CompressMemToFile(ByVal inData As Byte(), ByVal destPath As String) As Boolean` |
| `CompressSb` | method | `Function CompressSb(ByVal sb As StringBuilder, ByVal charset As String, ByVal bd As BinData) As Boolean` |
| `CompressString` | method | `Function CompressString(ByVal inStr As String, ByVal destCharset As String) As Byte()` |
| `CompressStringENC` | method | `Function CompressStringENC(ByVal inStr As String, ByVal charset As String, ByVal encoding As String) As String` |
| `CompressStringToFile` | method | `Function CompressStringToFile(ByVal inStr As String, ByVal destCharset As String, ByVal destPath As String) As Boolean` |
| `GetGzipInfo` | method | `Function GetGzipInfo(ByVal filePath As String, ByVal json As JsonObject) As Boolean` |
| `GetGzipInfoBd` | method | `Function GetGzipInfoBd(ByVal bd As BinData, ByVal json As JsonObject) As Boolean` |
| `IsGzip` | method | `Function IsGzip(ByVal bd As BinData) As Boolean` |
| `LoadTaskCaller` | method | `Function LoadTaskCaller(ByVal task As Task) As Boolean` |
| `SetDt` | method | `Function SetDt(ByVal dt As CkDateTime) As Boolean` |
| `SetExtraData` | method | `Function SetExtraData(ByVal encodedData As String, ByVal encoding As String) As Boolean` |
| `UncompressBd` | method | `Function UncompressBd(ByVal binDat As BinData) As Boolean` |
| `UncompressBdToFile` | method | `Function UncompressBdToFile(ByVal bd As BinData, ByVal filePath As String) As Boolean` |
| `UncompressFile` | method | `Function UncompressFile(ByVal srcPath As String, ByVal destPath As String) As Boolean` |
| `UncompressFileToMem` | method | `Function UncompressFileToMem(ByVal srcPath As String) As Byte()` |
| `UncompressFileToString` | method | `Function UncompressFileToString(ByVal srcPath As String, ByVal charset As String) As String` |
| `UncompressMemory` | method | `Function UncompressMemory(ByVal inData As Byte()) As Byte()` |
| `UncompressMemToFile` | method | `Function UncompressMemToFile(ByVal inData As Byte(), ByVal destPath As String) As Boolean` |
| `UncompressString` | method | `Function UncompressString(ByVal inData As Byte(), ByVal inCharset As String) As String` |
| `UncompressStringENC` | method | `Function UncompressStringENC(ByVal inStr As String, ByVal charset As String, ByVal encoding As String) As String` |
| `UnTarGz` | method | `Function UnTarGz(ByVal gzPath As String, ByVal destDir As String, ByVal bNoAbsolute As Boolean) As Boolean` |
| `XfdlToXml` | method | `Function XfdlToXml(ByVal xfldData As String) As String` |

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

## Properties

### Gzip.AbortCurrent

`Chilkat 11.7.0 · vbnet · Gzip · AbortCurrent · property · read/write · since 9.5.0.58`

```vbnet
AbortCurrent As Boolean
```

Set this property to `True` to request that the currently running operation be aborted. This is useful for long-running operations such as large file compression or decompression. Methods that complete quickly are generally not affected.

If no method is currently running, the property is automatically reset to `False` when the next method begins. After an abort occurs, it is also reset to `False`. Both synchronous and asynchronous operations can be aborted. For synchronous calls, another thread must set this property.

### Gzip.Comment

`Chilkat 11.7.0 · vbnet · Gzip · Comment · property · read/write`

```vbnet
Comment As String
```

An optional comment to embed in the Gzip file when a `Compress*` method is called.

### Gzip.CompressionLevel

`Chilkat 11.7.0 · vbnet · Gzip · CompressionLevel · property · read/write · since 9.5.0.50`

```vbnet
CompressionLevel As Integer
```

Controls the compression level used when creating Gzip data. The value can range from `0` to `9`.

- `0` = no compression
- `9` = maximum compression

The default value is `6`, which is a typical balance between compression size and speed. Higher levels may take significantly more CPU time while producing only slightly smaller output, depending on the data.

### Gzip.ExtraData

`Chilkat 11.7.0 · vbnet · Gzip · ExtraData · property · read/write`

```vbnet
ExtraData As Byte()
```

Optional binary data to include in the Gzip header when a `Compress*` method is called.

### Gzip.Filename

`Chilkat 11.7.0 · vbnet · Gzip · Filename · property · read/write`

```vbnet
Filename As String
```

The filename to embed in the Gzip file when a `Compress*` method is called. Some Gzip extraction tools use this embedded filename as the default output filename.

### Gzip.HeartbeatMs

`Chilkat 11.7.0 · vbnet · Gzip · HeartbeatMs · property · read/write`

```vbnet
HeartbeatMs As Integer
```

**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. These callbacks allow an application to cancel certain long-running operations before they finish.

The default value is `0`, which means no `AbortCheck` callbacks are triggered.

### Gzip.LastModStr

`Chilkat 11.7.0 · vbnet · Gzip · LastModStr · property · read/write`

```vbnet
LastModStr As String
```

Specifies the last-modified date/time to embed in the Gzip file when a `Compress*` method is called.

The value must be provided as an RFC 822 formatted date/time string.

**Example:**

```
Sun, 12 Apr 2026 12:45:26 GMT
```

If this property is not set, the current system date/time is used automatically.

### Gzip.UseCurrentDate

`Chilkat 11.7.0 · vbnet · Gzip · UseCurrentDate · property · read/write`

```vbnet
UseCurrentDate As Boolean
```

Controls the last-modified date/time assigned to files created by `Uncompress*` methods.

When set to `True`, the extracted file uses the current date/time instead of the date/time stored in the Gzip data.

## Methods

### Gzip.CompressBd

`Chilkat 11.7.0 · vbnet · Gzip · CompressBd · method · since 9.5.0.67`

```vbnet
Function CompressBd(ByVal binDat As BinData) As Boolean
```

Compresses the contents of a `BinData` object in place, replacing the original data with Gzip-compressed data.

Returns True for success, False for failure.

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

### Gzip.CompressFile

`Chilkat 11.7.0 · vbnet · Gzip · CompressFile · method`

```vbnet
Function CompressFile(ByVal srcPath As String, ByVal destPath As String) As Boolean
```

Compresses a file and writes the result as a Gzip file, typically with a `.gz` extension.

Returns True for success, False for failure.

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

### Gzip.CompressFile2

`Chilkat 11.7.0 · vbnet · Gzip · CompressFile2 · method`

```vbnet
Function CompressFile2(ByVal srcPath As String, ByVal embeddedFilename As String, ByVal destPath As String) As Boolean
```

Compresses a file and writes the result as a Gzip file, while allowing a different filename to be embedded inside the Gzip data.

The `inFilename` parameter is the actual file on disk. The `srcPath` parameter is the filename stored in the Gzip header and may be used by extraction tools as the output filename.

Returns True for success, False for failure.

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

### Gzip.CompressFileBd

`Chilkat 11.7.0 · vbnet · Gzip · CompressFileBd · method · since 11.0.0`

```vbnet
Function CompressFileBd(ByVal filePath As String, ByVal bd As BinData) As Boolean
```

Compresses a file and stores the resulting Gzip data in a `BinData` object.

The compressed output is held in memory. The maximum compressed size is 4 GB.

Returns True for success, False for failure.

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

### Gzip.CompressFileToMem

`Chilkat 11.7.0 · vbnet · Gzip · CompressFileToMem · method`

```vbnet
Function CompressFileToMem(ByVal inFilename As String) As Byte()
```

Compresses a file and returns the resulting Gzip data as a byte array.

The compressed output is held in memory and has a maximum size limit of 4 GB.

Returns an empty byte array on failure

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

### Gzip.CompressMemory

`Chilkat 11.7.0 · vbnet · Gzip · CompressMemory · method`

```vbnet
Function CompressMemory(ByVal inData As Byte()) As Byte()
```

Compresses a byte array and returns the result as an in-memory Gzip image.

The uncompressed input data must not exceed 4 GB.

Returns an empty byte array on failure

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

### Gzip.CompressMemToFile

`Chilkat 11.7.0 · vbnet · Gzip · CompressMemToFile · method`

```vbnet
Function CompressMemToFile(ByVal inData As Byte(), ByVal destPath As String) As Boolean
```

Compresses a byte array and writes the resulting Gzip data to a file.

Returns True for success, False for failure.

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

### Gzip.CompressSb

`Chilkat 11.7.0 · vbnet · Gzip · CompressSb · method · since 11.0.0`

```vbnet
Function CompressSb(ByVal sb As StringBuilder, ByVal charset As String, ByVal bd As BinData) As Boolean
```

Compresses the text contained in a `StringBuilder` and writes the Gzip-compressed result to a `BinData` object.

Before compression, the string is converted to bytes using the specified character set, such as `utf-8`, `iso-8859-1`, or `shift_JIS`.

Returns True for success, False for failure.

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

### Gzip.CompressString

`Chilkat 11.7.0 · vbnet · Gzip · CompressString · method`

```vbnet
Function CompressString(ByVal inStr As String, ByVal destCharset As String) As Byte()
```

**Full documentation for this method (same in every language):** [Full List of Charset Names](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Compresses a string and returns the Gzip-compressed data as a byte array.

The string is first converted to bytes using the character set specified by `destCharset`. Common values include `utf-8`, `iso-8859-1`, and `shift_JIS`.

Returns an empty byte array on failure

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

### Gzip.CompressStringENC

`Chilkat 11.7.0 · vbnet · Gzip · CompressStringENC · method`

```vbnet
Function CompressStringENC(ByVal inStr As String, ByVal charset As String, ByVal encoding As String) As String
```

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

Compresses a string and returns the Gzip-compressed data as an encoded string.

The input string is first converted to bytes using the specified character set. The compressed binary data is then encoded using the requested encoding, such as `base64`, `hex`, `url`, `base32`, or quoted-printable.

Returns `Nothing` on failure

### Gzip.CompressStringToFile

`Chilkat 11.7.0 · vbnet · Gzip · CompressStringToFile · method`

```vbnet
Function CompressStringToFile(ByVal inStr As String, ByVal destCharset As String, ByVal destPath As String) As Boolean
```

**Full documentation for this method (same in every language):** [Full List of Charset Names](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Compresses a string and writes the resulting Gzip data to a file.

The string is first converted to bytes using the character set specified by `destCharset`.

Returns True for success, False for failure.

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

### Gzip.GetGzipInfo

`Chilkat 11.7.0 · vbnet · Gzip · GetGzipInfo · method · since 11.5.0`

```vbnet
Function GetGzipInfo(ByVal filePath As String, ByVal json As JsonObject) As Boolean
```

Retrieves metadata stored in a Gzip file and returns the information in a `JsonObject`.

The metadata is returned using the following JSON structure:

```
{
  "extraData": "AAECAw==",
  "filename": "example.txt",
  "comment": "This is the comment"
}
```

- **filename** – the original filename embedded in the Gzip file (if present)
- **comment** – an optional descriptive comment (if present)
- **extraData** – optional additional binary data, returned as a Base64-encoded string

Any of these fields may be omitted if they were not included when the Gzip file was created.

Returns True for success, False for failure.

### Gzip.GetGzipInfoBd

`Chilkat 11.7.0 · vbnet · Gzip · GetGzipInfoBd · method · since 11.5.0`

```vbnet
Function GetGzipInfoBd(ByVal bd As BinData, ByVal json As JsonObject) As Boolean
```

Retrieves metadata stored in Gzip data contained within a `BinData` object and returns the information in a `JsonObject`.

The metadata is returned using the same JSON structure:

```
{
  "extraData": "AAECAw==",
  "filename": "example.txt",
  "comment": "This is the comment"
}
```

- **filename** – the original filename embedded in the Gzip data (if present)
- **comment** – an optional descriptive comment (if present)
- **extraData** – optional additional binary data, returned as a Base64-encoded string

Any of these fields may be omitted if they were not included when the Gzip data was created.

Returns True for success, False for failure.

### Gzip.IsGzip

`Chilkat 11.7.0 · vbnet · Gzip · IsGzip · method · since 11.0.0`

```vbnet
Function IsGzip(ByVal bd As BinData) As Boolean
```

Checks whether the data contained in a `BinData` object is in Gzip format.

Returns `True` if the data is Gzip-formatted, or `False` otherwise.

### Gzip.LoadTaskCaller

`Chilkat 11.7.0 · vbnet · Gzip · LoadTaskCaller · method · since 9.5.0.80`

```vbnet
Function LoadTaskCaller(ByVal task As Task) As Boolean
```

Loads the caller of the task's async method.

Returns True for success, False for failure.

### Gzip.SetDt

`Chilkat 11.7.0 · vbnet · Gzip · SetDt · method`

```vbnet
Function SetDt(ByVal dt As CkDateTime) As Boolean
```

Sets the last-modified date/time to embed in the Gzip file when a `Compress*` method is called.

If no date/time is explicitly set, the current system date/time is used.

Returns True for success, False for failure.

### Gzip.SetExtraData

`Chilkat 11.7.0 · vbnet · Gzip · SetExtraData · method · since 11.0.0`

```vbnet
Function SetExtraData(ByVal encodedData As String, ByVal encoding As String) As Boolean
```

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

Sets optional extra binary data to include in the Gzip header when a `Compress*` method is called.

The data is passed as an encoded string. Supported encodings include `base64`, `hex`, `ascii`, and many others.

Returns True for success, False for failure.

### Gzip.UncompressBd

`Chilkat 11.7.0 · vbnet · Gzip · UncompressBd · method · since 9.5.0.67`

```vbnet
Function UncompressBd(ByVal binDat As BinData) As Boolean
```

Decompresses Gzip data contained in a `BinData` object in place, replacing the compressed data with the uncompressed data.

Returns True for success, False for failure.

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

### Gzip.UncompressBdToFile

`Chilkat 11.7.0 · vbnet · Gzip · UncompressBdToFile · method · since 11.0.0`

```vbnet
Function UncompressBdToFile(ByVal bd As BinData, ByVal filePath As String) As Boolean
```

Decompresses Gzip data stored in a `BinData` object and writes the result to a file.

Returns True for success, False for failure.

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

### Gzip.UncompressFile

`Chilkat 11.7.0 · vbnet · Gzip · UncompressFile · method`

```vbnet
Function UncompressFile(ByVal srcPath As String, ByVal destPath As String) As Boolean
```

Decompresses a Gzip file and writes the result to the specified output path.

The output filename is provided by the caller. The filename embedded in the Gzip data is not used.

Returns True for success, False for failure.

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

### Gzip.UncompressFileToMem

`Chilkat 11.7.0 · vbnet · Gzip · UncompressFileToMem · method`

```vbnet
Function UncompressFileToMem(ByVal srcPath As String) As Byte()
```

Decompresses a Gzip file and returns the uncompressed data as a byte array.

The uncompressed output is held in memory and must not exceed 4 GB.

Returns an empty byte array on failure

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

### Gzip.UncompressFileToString

`Chilkat 11.7.0 · vbnet · Gzip · UncompressFileToString · method`

```vbnet
Function UncompressFileToString(ByVal srcPath As String, ByVal charset As String) As String
```

**Full documentation for this method (same in every language):** [List of Valid Charsets](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Decompresses a Gzip file that contains text and returns the uncompressed text as a string.

The `charset` parameter specifies the character encoding of the uncompressed text, such as `utf-8`, `iso-8859-1`, `windows-1252`, `shift_JIS`, `big5`, etc.

Returns `Nothing` on failure

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

### Gzip.UncompressMemory

`Chilkat 11.7.0 · vbnet · Gzip · UncompressMemory · method`

```vbnet
Function UncompressMemory(ByVal inData As Byte()) As Byte()
```

Decompresses an in-memory Gzip image and returns the uncompressed data as a byte array.

The uncompressed output is held in memory and must not exceed 4 GB.

Returns an empty byte array on failure

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

### Gzip.UncompressMemToFile

`Chilkat 11.7.0 · vbnet · Gzip · UncompressMemToFile · method`

```vbnet
Function UncompressMemToFile(ByVal inData As Byte(), ByVal destPath As String) As Boolean
```

Decompresses an in-memory Gzip image and writes the uncompressed data to a file.

Returns True for success, False for failure.

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

### Gzip.UncompressString

`Chilkat 11.7.0 · vbnet · Gzip · UncompressString · method`

```vbnet
Function UncompressString(ByVal inData As Byte(), ByVal inCharset As String) As String
```

**Full documentation for this method (same in every language):** [Full List of Charset Names](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/charsets_supported_by_chilkat.md)

Decompresses Gzip-compressed data and returns the result as a string.

After decompression, the result is raw binary data (a sequence of bytes). These bytes are then interpreted as text using the specified character set (such as `utf-8`, `iso-8859-1`, etc.) to produce the final string.

Internally, Chilkat converts the byte sequence to a string by interpreting the bytes according to the specified character set. For example, if `utf-8` is specified, the bytes are treated as the UTF-8 byte representation of text and decoded into the internal string format used by the programming language.

It is important that the character set matches the one originally used when the data was compressed. If the wrong character set is used, the byte-to-text conversion may produce incorrect or unreadable characters.

Returns `Nothing` on failure

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

### Gzip.UncompressStringENC

`Chilkat 11.7.0 · vbnet · Gzip · UncompressStringENC · method`

```vbnet
Function UncompressStringENC(ByVal inStr As String, ByVal charset As String, ByVal encoding As String) As String
```

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

Decompresses Gzip data provided as an encoded string and returns the uncompressed result as text.

The input string is first decoded using the specified encoding, such as `base64`, `hex`, `url`, `base32`, quoted-printable, etc. The decoded Gzip data is then decompressed and converted to text using the specified character set.

Returns `Nothing` on failure

### Gzip.UnTarGz

`Chilkat 11.7.0 · vbnet · Gzip · UnTarGz · method`

```vbnet
Function UnTarGz(ByVal gzPath As String, ByVal destDir As String, ByVal bNoAbsolute As Boolean) As Boolean
```

Extracts a `.tar.gz` archive to a directory.

The Gzip decompression and TAR extraction are performed in streaming mode. No temporary files are created, and memory usage remains small and constant.

If `bNoAbsolute` is `True`, absolute paths in the TAR archive are not allowed. This helps protect against extracting files to unsafe locations, such as system directories.

Returns True for success, False for failure.

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

### Gzip.XfdlToXml

`Chilkat 11.7.0 · vbnet · Gzip · XfdlToXml · method`

```vbnet
Function XfdlToXml(ByVal xfldData As String) As String
```

**Full documentation for this method (same in every language):** [More about XFDL](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/xfdl.md)

Converts encoded and compressed XFDL data to a decompressed XML string.

XFDL data is often stored in an ASCII-safe compressed form, such as `asci-gzip` or `asc-gzip`. Despite the name, this does not always mean the data is a standard `.gz` file. In some XFDL files, the compressed payload uses the raw deflate format rather than the full Gzip file format.

Chilkat automatically detects the actual encoding and compression format used by the XFDL data. It decodes the ASCII/Base64 representation, determines whether the compressed data is Gzip or deflate, decompresses it correctly, and returns the resulting XML string.

This allows applications to call `XfdlToXml` without needing to manually distinguish between XFDL variants such as Base64+Gzip and Base64+Deflate.

Returns the decoded and decompressed XML string.

**XFDL (Extensible Forms Description Language)** is an XML-based format used to define secure, interactive electronic forms—often including digital signatures and integrity protections—commonly used in government and enterprise applications.

Returns `Nothing` on failure

## Events and callbacks

### Gzip.AbortCheck (event)

`Chilkat 11.7.0 · vbnet · Gzip · AbortCheck · event`

```vbnet
Event OnAbortCheck
```

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.

Event arguments are passed in a Chilkat.AbortCheckEventArgs object.

**Event callback implementation:**

Declare the object with the **WithEvents** keyword, then write a Sub with a **Handles** clause for the event. Visual Basic connects the two automatically, so no AddHandler call is needed.

```vbnet
Dim WithEvents gzip As Chilkat.Gzip

Private Sub gzip_OnAbortCheck(sender As Object, args As Chilkat.AbortCheckEventArgs) Handles gzip.OnAbortCheck

    ' application code goes here.

End Sub
```

### Gzip.PercentDone (event)

`Chilkat 11.7.0 · vbnet · Gzip · PercentDone · event`

```vbnet
Event OnPercentDone
```

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.

To abort the operation, set the `abort` output argument to `True`. This will cause the method to terminate and return a failure status or corresponding failure value.

Event arguments are passed in a Chilkat.PercentDoneEventArgs object.

**Event callback implementation:**

Declare the object with the **WithEvents** keyword, then write a Sub with a **Handles** clause for the event. Visual Basic connects the two automatically, so no AddHandler call is needed.

```vbnet
Dim WithEvents gzip As Chilkat.Gzip

Private Sub gzip_OnPercentDone(sender As Object, args As Chilkat.PercentDoneEventArgs) Handles gzip.OnPercentDone

    ' application code goes here.

End Sub
```

### Gzip.ProgressInfo (event)

`Chilkat 11.7.0 · vbnet · Gzip · ProgressInfo · event`

```vbnet
Event OnProgressInfo
```

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.

Event arguments are passed in a Chilkat.ProgressInfoEventArgs object.

**Event callback implementation:**

Declare the object with the **WithEvents** keyword, then write a Sub with a **Handles** clause for the event. Visual Basic connects the two automatically, so no AddHandler call is needed.

```vbnet
Dim WithEvents gzip As Chilkat.Gzip

Private Sub gzip_OnProgressInfo(sender As Object, args As Chilkat.ProgressInfoEventArgs) Handles gzip.OnProgressInfo

    ' application code goes here.

End Sub
```

### Gzip.TaskCompleted (event)

`Chilkat 11.7.0 · vbnet · Gzip · TaskCompleted · event`

```vbnet
Event OnTaskCompleted
```

Called from the background thread when an asynchronous task completes.

Event arguments are passed in a Chilkat.TaskCompletedEventArgs object.

**Event callback implementation:**

Declare the object with the **WithEvents** keyword, then write a Sub with a **Handles** clause for the event. Visual Basic connects the two automatically, so no AddHandler call is needed.

```vbnet
Dim WithEvents gzip As Chilkat.Gzip

Private Sub gzip_OnTaskCompleted(sender As Object, args As Chilkat.TaskCompletedEventArgs) Handles gzip.OnTaskCompleted

    ' application code goes here.

End Sub
```

## 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.

```vbnet
Function CompressBdAsync(ByVal binDat As BinData) As Task
Function CompressFileAsync(ByVal srcPath As String, ByVal destPath As String) As Task
Function CompressFile2Async(ByVal srcPath As String, ByVal embeddedFilename As String, ByVal destPath As String) As Task
Function CompressFileBdAsync(ByVal filePath As String, ByVal bd As BinData) As Task
Function CompressFileToMemAsync(ByVal inFilename As String) As Task
Function CompressMemoryAsync(ByVal inData As Byte()) As Task
Function CompressMemToFileAsync(ByVal inData As Byte(), ByVal destPath As String) As Task
Function CompressSbAsync(ByVal sb As StringBuilder, ByVal charset As String, ByVal bd As BinData) As Task
Function CompressStringAsync(ByVal inStr As String, ByVal destCharset As String) As Task
Function CompressStringToFileAsync(ByVal inStr As String, ByVal destCharset As String, ByVal destPath As String) As Task
Function UncompressBdAsync(ByVal binDat As BinData) As Task
Function UncompressBdToFileAsync(ByVal bd As BinData, ByVal filePath As String) As Task
Function UncompressFileAsync(ByVal srcPath As String, ByVal destPath As String) As Task
Function UncompressFileToMemAsync(ByVal srcPath As String) As Task
Function UncompressFileToStringAsync(ByVal srcPath As String, ByVal charset As String) As Task
Function UncompressMemoryAsync(ByVal inData As Byte()) As Task
Function UncompressMemToFileAsync(ByVal inData As Byte(), ByVal destPath As String) As Task
Function UncompressStringAsync(ByVal inData As Byte(), ByVal inCharset As String) As Task
Function UnTarGzAsync(ByVal gzPath As String, ByVal destDir As String, ByVal bNoAbsolute As Boolean) As Task
```

## Deprecated members — do not use in new code

| Member | Kind | Deprecated in | Use instead |
|---|---|---|---|
| `Decode` | method | before 11.6.1 | — |
| `DeflateStringENC` | method | before 11.6.1 | — |
| `Encode` | method | before 11.6.1 | — |
| `ExamineFile` | method | before 11.6.1 | — |
| `ExamineMemory` | method | before 11.6.1 | — |
| `GetDt` | method | before 11.6.1 | — |
| `InflateStringENC` | method | before 11.6.1 | — |
| `ReadFile` | method | before 11.6.1 | — |
| `WriteFile` | method | before 11.6.1 | — |

## Related classes

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

