Append a single file to zip, overwriting the existing file if necessary
Project description
append-zip
Appends a file to a zip file, overwriting the existing file there if necessary
Performance
Not efficient; extracts all the files in the zip, copies over the new file, and compresses a brand new zip replacing the original one. You will need enough disk space to duplicate the zip file.
Caveats
for some reason, windows has a different file length after unzipping (by 10-20 bytes). So beware how this works on windows
Getting started
install (on Mac)
$ python3 -m pip install appendzip
from appendzip.appendzip import appendzip
# before appendzip calendar.txt in the zip archive test.zip contains 2021-01-02
# before appendzip calendar.txt outside the zip contains 2022-02-03
appendzip(
pathlib.Path('test.zip'),
pathlib.Path('calendar.txt'),
'calendar.txt'
)
# after appendzip calendar.txt inside the zip contains 2022-02-03
# after, there is still only one file in the zip archive test.zip
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
appendzip-0.1.0.tar.gz
(3.0 kB
view details)
Built Distribution
File details
Details for the file appendzip-0.1.0.tar.gz
.
File metadata
- Download URL: appendzip-0.1.0.tar.gz
- Upload date:
- Size: 3.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ca02cc4e95fda15ea48df3c5c2daf752517d6a844eed41a2f2556af2a8142d8 |
|
MD5 | ef5a2dff4b4473b4e539b88331ff42b7 |
|
BLAKE2b-256 | 2e96670f721da801b00320790986cb58d108adecd25eaae628c119931f0d85f9 |
File details
Details for the file appendzip-0.1.0-py3-none-any.whl
.
File metadata
- Download URL: appendzip-0.1.0-py3-none-any.whl
- Upload date:
- Size: 3.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.3 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e38e14820faa2376fd7b58ccccc7d9c8f608c5a73ae42a32bf7d6a842506fa10 |
|
MD5 | 9a66286586b442bb3be25daf23900aef |
|
BLAKE2b-256 | 961f1c23a324425b8e2c733ceb7950b414c4acb3d4da8d51a671de01f18f5dff |