extractTarGz

fun extractTarGz(tarGzFile: File, targetDir: File)

Extracts a .tar.gz archive to a target directory via external tar command.

Pre-scans the archive entries to reject any containing directory-traversal (..).

Parameters

tarGzFile

The tar.gz archive to extract.

targetDir

The directory to extract into (created if it does not exist).

Throws

if any entry contains directory traversal.