zip-rs / zip2

Zip implementation in Rust
Other
94 stars 32 forks source link

Make things for inspecting and manipulating PKZip structures public #180

Open daniel-abramov opened 6 years ago

daniel-abramov commented 6 years ago

I wanted to ask your opinion regarding one question. What do you think about making some private structures and functions public? In particularly I mean the structure which represents the parsed local file header and the functions which allow you to write local file header and central directory headers based on the parsed structure.

I find them very useful. Recently I had to work with the internals of the ZIP format a lot, but I did not want to use the whole functionality of compressing / decompressing, just wanted to access the internal structures of ZIP format, change them and write them again in a new file. Here zip-rs was very useful, but I had to make some things public.

Basically it's not a lot of work to do, and the required changes are already pushed to my fork: https://github.com/snapview/zip-rs/tree/make-some-apis-public

The only thing which may make sense is making them feature-guarded, so that the users who just want to use the "regular zip functionality" / who are not familiar with the structure of PKZip file don't get confused by seeing these additional functions and structures.

What do you think?

rylev commented 4 years ago

🙋‍♀️ HI, new maintainer here. I think this sounds like a good idea. I'll need a little bit of time to get familiar with the crate to decide exactly how to do this. One possibility is creating a new crate that exposes zip file parsing functionality/definitions that both your crate and the main zip-rs crate can depend on. Please ping me if I haven't revisited this in ~4 weeks time.

zamazan4ik commented 2 years ago

@Plecra I think this commit can be quite useful for our users: https://github.com/snapview/zip-rs/commit/ed7b708057ac38b1372cf1de793b59de82014435

And it doesn't break API. What do you think?

Plecra commented 2 years ago

I wouldn't. They're not very good function signatures, and they change semi-regularly. They're perfect fits for the zip-format crate we were talking about though, where they could be public.

Plecra commented 1 year ago

I've just reopened https://github.com/zip-rs/zip/pull/292, which is a step towards exposing this. Once we've merged that, it's just a matter of moving the declarations into the new zip-format crate at 0.1. It's low priority for now, but PRs will be accepted following zip-rs/zip-old#292