jgdv.mixins.zipper
Classes
Add methods for manipulating zip files. |
Module Contents
- class jgdv.mixins.zipper.Zipper_m[source]
Add methods for manipulating zip files. Can set a self.zip_root path, where added files with be relative to
- zip_add_paths(fpath, *args) <Unknown>[source]
- Add specific files to the zip.
Will Create the zip if it doesn’t exist
- Parameters:
fpath (pathlib.Path)
args (pathlib.Path)
- zip_add_str(fpath, fname, text) <Unknown>[source]
add a string of text to a zip file as a new file
- Parameters:
fpath (pathlib.Path)
fname (str)
text (str)
- zip_contains(zip, *names) <Unknown>[source]
test that a zip file contains multiple filenames
- Parameters:
zip (pathlib.Path)
names (str | pathlib.Path)
- Return type:
- zip_create(fpath) <Unknown>[source]
Create a new zipfile. will overwrite an existing zip if ‘zip_overwrite’ is set
- Parameters:
fpath (pathlib.Path)
- zip_get_contents(fpath) <Unknown>[source]
- Parameters:
fpath (pathlib.Path)
- Return type:
- zip_globs(
- fpath,
- *globs,
- ignore_dots=False,
Add files chosen by globs to the zip, relative to the cwd
- Parameters:
fpath (pathlib.Path)
globs (str)
- zip_set_root(fpath) <Unknown>[source]
set the filesystem that acts as the root for paths to be added to the zip file
- Parameters:
fpath (pathlib.Path)
- zip_test(*zips) <Unknown>[source]
Test the validity of zip files
- Parameters:
zips (pathlib.Path)
- zip_unzip_concat(
- fpath,
- *zips,
- member=None,
- header=b'\n\n#------\n\n',
- footer=b'\n\n#------\n\n',
Unzip a member file in a multiple zip files, append their text contents into a single file
- Parameters:
fpath (pathlib.Path)
zips (pathlib.Path)
- zip_unzip_to(fpath, *zips, fn=None) <Unknown>[source]
extract everything or everything that returns true from fn, from all zips given into subdirs of fpath
- Parameters:
fpath (pathlib.Path)
zips (pathlib.Path)
- zip_root: jgdv.Maybe[pathlib.Path] = None