Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
[6.x] Allow Storage::put to accept a Psr StreamInterface #30179
This PR will allow the Storage::put method to accept a Psr StreamInterface. This will mostly be useful when dealing with guzzle, as you will no longer have to manually call detach and pass a resource to Storage::put.
This will not break existing features as it's broadening what the method accepts.
@netpok That's a good point, it could be pretty confusing/irritating. I guess the alternative would be to avoid using detach and instead read the contents of the stream into memory, then use the regular put method?
Obvious problem with that is that you have the whole contents of the stream in memory, which sorta defeats the point of using a stream. I also looked into chunking it without the use of putStream, but it doesn't look like you can consistently append to a file without relying on the config of the flysystem adapter.
I'm happy to drop this if the overall behaviour is too confusing. Or at the very least, come back to it when I have a better solution