Sample code for 30+ languages & platforms
Delphi DLL

GZip Tar Extract (.tgz or .tar.gz)

See more Gzip Examples

Demonstrates how to extract the contents of a GZip compressed Tar archive (.tgz or .tar.gz).

Chilkat Delphi DLL Downloads

Delphi DLL
uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
    Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Gzip;

...

procedure TForm1.Button1Click(Sender: TObject);
var
success: Boolean;
gzip: HCkGzip;
bNoAbsolute: Boolean;
untarToDirectory: PWideChar;

begin
success := False;

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

gzip := CkGzip_Create();

// Ungzip and untar.
bNoAbsolute := True;

untarToDirectory := '/temp/test';
// bNoAbsolute tells the component to convert all absolute paths
// found in the .tar to relative paths.   For example, if the .tar
// contains a file with an absolute path such as
// "/usr/bin/something.exe" it will
// be extracted to "/temp/test/usr/bin/something.exe"
success := CkGzip_UnTarGz(gzip,'test.tar.gz',untarToDirectory,bNoAbsolute);
if (success <> True) then
  begin
    Memo1.Lines.Add(CkGzip__lastErrorText(gzip));
    Exit;
  end;

CkGzip_Dispose(gzip);

end;