Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gzip Decompress #50

Closed
boardmain opened this issue Nov 2, 2015 · 1 comment
Closed

Gzip Decompress #50

boardmain opened this issue Nov 2, 2015 · 1 comment

Comments

@boardmain
Copy link

Hi how can i parse gzip compressed response?

@clue
Copy link
Contributor

clue commented Nov 15, 2015

Thanks for your question @boardmain! Compression and decompression is actually out of scope for this library.

You may want to look into using an additional streaming (de-)compression library. The only such library I'm currently aware of is my clue/zlib-react.

Usage depends on your concrete application protocol, but it may look something like this:

$connector->create('example.com', 1337)->then(function (Stream $stream) {
    $decompressor = \Clue\React\Zlib\ZlibFilterStream::createGzipDecompressor();

    $decompressor->on('data', function ($data) {
        echo $data;
    });

    $stream->pipe($decompressor);
});

If you're looking into processing a decompressed, streaming HTTP body, you may have to wait for reactphp/http-client#37. This will probably handle this similarly internally.

I hope this helps 👍

@clue clue closed this as completed Nov 15, 2015
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants