-
Notifications
You must be signed in to change notification settings - Fork 204
Conversation
As previous solution was messy I looked for help in community and came up with simpler and more clear solution now to generalize both seekable and unseekable stream. Also added one more test - when created into unseekable stream, it can be extracted then from same data, now presented as seekable stream.
This is very nice, thankyou! I don't see any reason not to merge this, but it's got a couple blockers: Could you rebase it on master and run |
@Plecra What about this - I see that build on 1.24 is failing but it is on miniz_oxide v0.4.0 which is dependency in code not used by this change. |
Yes, it's unfortunately blocking the build at the moment. I should be able to manually review this soon |
@izderadicka I'll review these changes within the next week, and hopefully add them to an upcoming release. Lmk if there are any more changes you'd like to make first 😄 |
Any updates on when maintainers will have time to upstream this? |
Just a quick update, currently using code from this PR and it seems to work really well. Thanks Ivan! |
Annoyingly, there are too many changes to master to merge this right now. I'd like to revisit the feature soon, and this PR proves we can do that in 0.6 without breaking changes. Thankyou for the contribution 😄 |
This is my initial attempt for #16 implementation.
Although the actual change is not big:
a) if stream is not seekable set 4th bit in general flags in file local header
b) when file is finished do not update file local header, but instead write data descriptor record.
However significant work was need to make ZipWriter to work with both Seek and non Seek streams and also keep current interface and functionality untouched. This should be non-breaking change - all current functionality works as it is. Only there is new associated method to create ZipWriter::new_streaming , which accepts steam that does not support Seek and through it new functionality will be available.
The key change is introduction of
WriterWrapper
struct, which calculates output stream position for nonseekable stream (based on number of bytes written there), but for seekable stream uses wrapped stream functionality -seek
function. It also has methodcan_seek
, which enables to decide (after file is finished) if we can update local file header.I made one basic test and also tested result with unzip utility in linux, where it worked. I guess more tests and more work is needed, just wanted to check if this can be a way forward for this functionality.