Does PHP have an extension that permits to use a tar.gz like a folder?
I have some file that uses a similar structure and I don't need to extract all to read information about it, so can I make file_get_contents("my/path/to/tar/something.tar.gz/out.json");
?
Tape Archive or tar is a file format for creating files and directories into an archive while preserving filesystem information such as permissions. We can use the tar command to create tar archives, extract the archives, view files and directories stored in the archives, and append files to an existing archive.
Use PHP's Phar extension. For an introduction, see PHP: Using Phar Archives: Introduction.
file_get_contents("phar://my/path/to/tar/something.tar.gz/out.json");
If you don't already have Phar, you can install the PHP_Archive package or use the PECL extension.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With