Here we simply take a tar archive called
archive.tar
and extract its contents to the folder
<?php
require_once "File/Archive.php";
File_Archive::extract('archive.tar/', 'output');
?>
<?php
require_once "File/Archive.php";
File_Archive::extract(
//The content of archive.tar appears in the root folder (default argument)
'archive.tar/',
//And is written to ...
File_Archive::toArchive( // ... a zip archive
'archive.zip', // called archive.zip
File_Archive::toOutput() // that will be sent to the standard output
)
);
?>
Use extract() to get files out of an archive. When specifying the file to extract, make sure to use the archive name as first folder.
<?php
require_once "File/Archive.php";
File_Archive::extract(
'archive.tar/inner.tgz/file.txt',
File_Archive::toOutput()
);
?>