mirror of
https://github.com/splitbrain/php-archive.git
synced 2025-07-15 03:46:31 +02:00
added compression example to README
This commit is contained in:
@ -54,12 +54,13 @@ $tar->close();
|
|||||||
// To create a TAR archive directly in memory, create() it, add*()
|
// To create a TAR archive directly in memory, create() it, add*()
|
||||||
// files and then either save() or getArchive() it:
|
// files and then either save() or getArchive() it:
|
||||||
$tar = new Tar();
|
$tar = new Tar();
|
||||||
|
$tar->setCompression(9, Archive::COMPRESS_BZIP);
|
||||||
$tar->create();
|
$tar->create();
|
||||||
$tar->addFile(...);
|
$tar->addFile(...);
|
||||||
$tar->addData(...);
|
$tar->addData(...);
|
||||||
...
|
...
|
||||||
$tar->save('myfile.tgz'); // compresses and saves it
|
$tar->save('myfile.tbz'); // compresses and saves it
|
||||||
echo $tar->getArchive(Archive::COMPRESS_GZIP); // compresses and returns it
|
echo $tar->getArchive(); // compresses and returns it
|
||||||
```
|
```
|
||||||
|
|
||||||
Differences between Tar and Zip: Tars are compressed as a whole, while Zips compress each file individually. Therefore
|
Differences between Tar and Zip: Tars are compressed as a whole, while Zips compress each file individually. Therefore
|
||||||
|
Reference in New Issue
Block a user