Streaming zlib compressor and decompressor, built on top of React PHP, supporting compression and decompression of the following formats:
- RFC 1952 (GZIP compressed format)
- RFC 1951 (raw DEFLATE compressed format)
- RFC 1950 (ZLIB compressed format)
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 gzip file stream into an decompressor which emits decompressed data events for each individual file chunk:
$loop = React\EventLoop\Factory::create();
$stream = new Stream(fopen('access.log.gz', 'r'), $loop);
$decompressor = ZlibFilterStream::createGzipDecompressor();
$decompressor->on('data', function ($data) {
echo $data;
});
$stream->pipe($decompressor);
$loop->run();
See also the examples.
The recommended way to install this library is through composer. New to composer?
$ composer require clue/zlib-react:dev-master
MIT