Async, streaming parser for the TAR file format (Tape ARchive), built on top of React PHP.
Implements UStar (Uniform Standard Tape ARchive) format, introduced by the POSIX IEEE P1003.1
Note: This project is in early alpha stage! Feel free to report any issues you encounter.
Once installed, you can use the following code to pipe a readable
tar stream into the Decoder
which emits "entry" events for each individual file:
$loop = React\EventLoop\Factory::create();
$stream = new Stream(fopen('archive.tar', 'r'), $loop);
$decoder = new Decoder();
$decoder->on('entry', function ($header, ReadableStreamInterface $file) {
echo 'File ' . $header['filename'] . '
echo $header['size'] . ' bytes:' . PHP_EOL;
$file->on('data', function ($chunk) {
echo $chunk;
});
});
$stream->pipe($decoder);
$loop->run();
See also the examples.
The recommended way to install this library is through composer. New to composer?
{
"require": {
"clue/tar-react": "dev-master"
}
}
MIT