Skip to content

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

License

Notifications You must be signed in to change notification settings

clue-labs/reactphp-tar

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

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

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PHP 100.0%