You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Per discussion with Diego on Slack, it would be good to avoid copying all the data for a compressed file stream into memory before returning it to the user, and instead have a way of streaming it directly from the source zipfile.
Slack conversation:
Mike Bennett
[5:31 PM]
Today's shower thoughts - I am not 100% happy with using php://temp when retrieving a stream for inside the zip. We can't just attach the zlib.inflate filter to the main stream, because then the end user has to handle knowing where to seek to and how much data to read (rather than just being able to while(!feof($fp)) on the returned pointer), so the general pattern has to stay, but rather than opening the temp and doing stream_copy_to_stream directly, maybe we could implement a PartialReader that implements the interface required by fread and can be passed to the end user instead.
[5:33]
This would eliminate the need to use php://temp as we could just create the new class directly (instantiating it with the offset and length) and pass that to the end user from ::getStream().
[5:33]
I think this is broadly similar to what you were talking about in this comment: #8 (comment)
Diego Pino
[6:15 PM]
I will go pragmatic here. The main question is, if you are extracting a file from the ZIP, what is the most plausible thing you will do with it? I would say, save locally/do something with it or deliver as download.
[6:16]
So, that said, PartialReader sounds good
The text was updated successfully, but these errors were encountered:
Per discussion with Diego on Slack, it would be good to avoid copying all the data for a compressed file stream into memory before returning it to the user, and instead have a way of streaming it directly from the source zipfile.
Slack conversation:
The text was updated successfully, but these errors were encountered: