2017 © Pedro Peláez
 

library tar-react

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

image

clue/tar-react

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

  • Tuesday, June 14, 2016
  • by clue
  • Repository
  • 1 Watchers
  • 6 Stars
  • 845 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 1 Forks
  • 3 Open issues
  • 2 Versions
  • 23 % Grown

The README.md

clue/reactphp-tar

CI status installs on Packagist, (*1)

Streaming parser to extract tarballs with ReactPHP., (*2)

The TAR file format is a common archive format to store several files in a single archive file (commonly referred to as "tarball" with a .tar extension). This lightweight library provides an efficient implementation to extract tarballs in a streaming fashion, processing one chunk at a time in memory without having to rely on disk I/O., (*3)

Table of Contents, (*4)

Note: This project is in beta stage! Feel free to report any issues you encounter., (*5)

Quickstart example

Once installed, you can use the following code to pipe a readable tar stream into the TarDecoder which emits "entry" events for each individual file:, (*6)

<?php

require __DIR__ . '/vendor/autoload.php';

$stream = 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);

See also the examples., (*7)

Install

The recommended way to install this library is through Composer. New to Composer?, (*8)

While in beta, this project does not currently follow SemVer. This will install the latest supported version:, (*9)

composer require clue/tar-react:^0.2

See also the CHANGELOG for details about version upgrades., (*10)

This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 8+. It's highly recommended to use the latest supported PHP version for this project., (*11)

Tests

To run the test suite, you first need to clone this repo and then install all dependencies through Composer:, (*12)

composer install

To run the test suite, go to the project root and run:, (*13)

vendor/bin/phpunit

License

This project is released under the permissive MIT license., (*14)

Did you know that I offer custom development services and issuing invoices for sponsorships of releases and for contributions? Contact me (@clue) for details., (*15)

More

  • If you want to learn more about processing streams of data, refer to the documentation of the underlying react/stream component., (*16)

  • If you want to process compressed tarballs (.tar.gz and .tgz file extension), you may want to use clue/reactphp-zlib on the compressed input stream before passing the decompressed stream to the tar decoder., (*17)

The Versions

14/06 2016

dev-master

9999999-dev https://github.com/clue/php-tar-react

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Lück

parser async extractor archive decoder tar reactphp unpacker

17/06 2015

v0.1.0

0.1.0.0 https://github.com/clue/php-tar-react

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

  Sources   Download

MIT

The Requires

 

The Development Requires

by Christian Lück

parser async extractor archive decoder tar reactphp unpacker