wheel (GitLab)
wheel (GHA via nightly.link)
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:
- Find in headers the offset of the file within archive.
- Seek to that offset.
- Overwrite the data.