-
Notifications
You must be signed in to change notification settings - Fork 217
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
Bugfix - Make sure readStream actually reads a stream #211
Bugfix - Make sure readStream actually reads a stream #211
Conversation
Leave the option overwritable by the options array passed in the constructor.
prevent BC breaking change since protected methods are part of the (semi) public interface of this class
@tstrijdhorst could you have a look at the failing tests? If not, I can look at it tonight. |
I spend an hour stepping through the tests but I cannot find where the problem is. The code itself works when I use it in my project but the tests fail locally as well. I'm not exactly sure what it is but I notice that if i take out the The problem seems to be with the tests / mocks itself but I have no experience with phpspec so that makes debugging it a bit hard. For instance this Also the difference between these two tests is not entirely clear to me: |
…`readStream` method
Had an epiphany in bed yesterday, thx Rich Hickey for hammock driven design 🏖️ 😛 Tests are all fixed now. |
Awesome, thank you @tstrijdhorst! I'll tag a release tonight. |
@tstrijdhorst Found some time during my lunch break, version 1.0..26 is all yours! 👍 |
@frankdejonge thanks for the swift and straight forward communication 🙏 |
This is a breaking change! |
Problem
By default
readStream
does not stream data from S3 itself but it will download the whole file into memory and pass a stream resource to that data in local memory. If you want to stream data directly from S3 you will need to pass (a strangely undocumented) option in the constructor as per suggestion here: https://github.com/thephpleague/flysystem-aws-s3-v3/issues/124#issuecomment-330589497However if this option is passed via the constructor then
writeStream
will fail with an exception as described here: https://github.com/thephpleague/flysystem-aws-s3-v3/issues/209Proposed Solution
By default always assume that
readStream
means that the client wants to stream directly from S3 and always pass the aforementioned option when calling the S3 sdk. The order is done in such a way that setting this option via the constructor will have precedence over the default.