zimscraperlib.filesystem
Files manipulation tools
Shortcuts to retrieve mime type using magic
Functions:
-
delete_callback–helper deleting passed filepath
-
get_content_mimetype–MIME Type of content retrieved from magic headers
-
get_file_mimetype–MIME Type of file retrieved from magic headers
-
path_from–Context manager to get a Path from a path as string, Path or TemporaryDirectory
Attributes:
MIME_OVERRIDES
module-attribute
MIME_OVERRIDES = {'image/svg': 'image/svg+xml'}
delete_callback
delete_callback(fpath: Path)
helper deleting passed filepath
Source code in src/zimscraperlib/filesystem.py
42 43 44 | |
get_content_mimetype
MIME Type of content retrieved from magic headers
Source code in src/zimscraperlib/filesystem.py
28 29 30 31 32 33 34 35 36 37 38 39 | |
get_file_mimetype
MIME Type of file retrieved from magic headers
Source code in src/zimscraperlib/filesystem.py
18 19 20 21 22 23 24 25 | |
path_from
path_from(path: Path | TemporaryDirectory[Any] | str)
Context manager to get a Path from a path as string, Path or TemporaryDirectory
Since scraperlib wants to manipulate only Path, scrapers might often needs this to create a path from what they have, especially since TemporaryDirectory context manager returns a string which is not really handy.
Source code in src/zimscraperlib/filesystem.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | |