Skip to content

KOLANICH-libs/zipcraft.py

Repository files navigation

zipcraft.py Unlicensed work

wheel (GitLab) wheel (GHA via nightly.link) GitLab Build Status GitLab Coverage Coveralls Coverage GitHub Actions Libraries.io Status

This library allows you to edit zipfiles in-place, something that zipfile doesn't allow you.

Not fully, but in some assumption:

  • only uncompressed files within archive can be edited. Archives of uncompressed files are very widespread as containers, examples are:

    • python wheels
    • Mozilla Firefox extensions
  • you can overwrite existing files, you cannot delete them. It would require shifting.

  • the content you writes must occupy exactly the same size. You must yourself find the most suitable way for you to make it occupy the needed size. I. e. some file formats have padding.

In these assumptions the task is very easy:

  1. Find in headers the offset of the file within archive.
  2. Seek to that offset.
  3. Overwrite the data.

About

Zip witchcraft. Doing some "forbidden" things with `zipfile`s in some assumptions.

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages