Tar

Implements ExtractableInterface

Tar format adapter for the Archive package

This class is inspired from and draws heavily in code and concept from the Compress package of The Horde Project http://www.horde.org

contributor

Michael Slusarz [email protected]

Michael Cochrane [email protected]

since

1.0

package

Joomla Framework

Methods

__construct

Create a new Archive object.

__construct(array|\ArrayAccess options = []) : 
since

1.0

throws

InvalidArgumentException

Arguments

options

array<string|int, mixed>|ArrayAccessAn array of options or an object that implements \ArrayAccess

Response

mixed

extract

Extract a ZIP compressed file to a given path

extract( archive,  destination) : 
since

1.0

throws

RuntimeException

Arguments

archive

stringPath to ZIP archive to extract

destination

stringPath to extract archive into

Response

boolTrue if successful

getTarInfo

Get the list of files/data from a Tar archive buffer and builds a metadata array.

getTarInfo( &data) : 

Array structure:

KEY: Position in the array
VALUES: 'attr'  --  File attributes
'data'  --  Raw file contents
'date'  --  File modification time
'name'  --  Filename
'size'  --  Original file size
'type'  --  File type
since

1.0

throws

RuntimeException

Arguments

data

stringThe Tar archive buffer.

Response

void

isBelow

Check if a path is below a given destination path

isBelow( destination,  path) : 
since

2.0.1

Arguments

destination

stringThe destination path

path

stringThe path to be checked

Response

bool

isSupported

Tests whether this adapter can unpack files on this computer.

isSupported() : 
static
since

1.0

Response

boolTrue if supported

Constants

TYPES

Tar file types.

Value [0x0 => 'Unix file', 0x30 => 'File', 0x31 => 'Link', 0x32 => 'Symbolic link', 0x33 => 'Character special file', 0x34 => 'Block special file', 0x35 => 'Directory', 0x36 => 'FIFO special file', 0x37 => 'Contiguous file']
since

1.0

Type(s)

array<string|int, mixed>

Properties

data

Tar file data buffer

since

1.0

Type(s)

string|null

metadata

Tar file metadata array

since

1.0

Type(s)

array<string|int, mixed>

options

Holds the options array.

since

1.0

Type(s)

array<string|int, mixed>|ArrayAccess