# tarTree

fun tarTree(tarPath: Any): FileTree(source)

Creates a new FileTree which contains the contents of the given TAR file.

The given tarPath path can be:

- an instance of org.gradle.api.resources.Resource,

- any other object is evaluated as per KotlinInitScript.file.

The returned file tree is lazy, so that it scans for files only when the contents of the file tree are queried. The file tree is also live, so that it scans for files each time the contents of the file tree are queried.

Unless custom implementation of resources is passed, the tar tree attempts to guess the compression based on the file extension.

You can combine this method with the KotlinInitScript.copy method to unzip a ZIP file.

#### Return

The file tree.

#### Since

4.7

#### Parameters

tarPath

The TAR file or an instance of org.gradle.api.resources.Resource.