Skip to content

About

Async, streaming parser for the TAR file format (Tape ARchive), built on top of React PHP

Resources

Stars

0 stars

Watchers

1 watching

Forks

 
 

Latest commit

 

History

1 Commit

Folders and files

Repository files navigation

clue/tar-react Build Status

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.

Quickstart example

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.

Install

The recommended way to install this library is through composer. New to composer?

{
    "require": {
        "clue/tar-react": "dev-master"
    }
}

License

MIT

About

Async, streaming parser for the TAR file format (Tape ARchive), built on top of React PHP

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages