PHP code example of clue / tar-react
1. Go to this page and download the library: Download clue/tar-react library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
clue / tar-react example snippets
am = new React\Stream\ReadableResourceStream(fopen('archive.tar', 'r'));
$decoder = new Clue\React\Tar\TarDecoder();
$decoder->on('entry', function (array $header, React\Stream\ReadableStreamInterface $file) {
echo 'File ' . $header['filename'];
echo ' (' . $header['size'] . ' bytes):' . PHP_EOL;
$file->on('data', function ($chunk) {
echo $chunk;
});
});
$stream->pipe($decoder);