-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support react/stream from 0.6 to ^1 #8
Conversation
src/Decoder.php
Outdated
@@ -199,7 +200,7 @@ private function readHeader($header) | |||
$record = unpack($this->format, $header); | |||
|
|||
// we only support "ustar" format (for now?) | |||
if ($record['magic'] !== 'ustar') { | |||
if (rtrim($record['magic']) !== 'ustar') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The rtrim
is required for a tar created with GNU tar 1.32.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, I guess this is the response to issues I've posted earlier today. I have done exactly the same tweaks myself (except |
@clue Do you think this can be merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dontub Thank you very much for looking into this and filing this PR!
I'm currently busy with a few other projects and will get back to this as soon as time permits. I think your changes are an excellent starting point and I will look into this again in more detail then. In the meantime, here are a couple of quick remarks.
src/Decoder.php
Outdated
@@ -199,7 +200,7 @@ private function readHeader($header) | |||
$record = unpack($this->format, $header); | |||
|
|||
// we only support "ustar" format (for now?) | |||
if ($record['magic'] !== 'ustar') { | |||
if (rtrim($record['magic']) !== 'ustar') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
examples/dump.php
Outdated
@@ -27,7 +25,7 @@ | |||
echo 'Received entry headers:' . PHP_EOL; | |||
var_dump($header); | |||
|
|||
BufferedSink::createPromise($file)->then(function ($contents) { | |||
$file->on('data', function ($contents) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will now print this message for each chunk of data whereas the old version buffered the whole file. Possible alternative: https://github.com/reactphp/promise-stream#buffer
@clue Thanks for your initial feedback. I hope you can get some time to continue... |
Didn't see this PR and worked on this today as well, my code is very similar to this PR. Good work 👌 |
This PR adds support for current versions of react/stream.