fs.zipfs¶
A FS object that represents the contents of a Zip file
- class fs.zipfs.ZipFS(zip_file, mode='r', compression='deflated', allow_zip_64=False, encoding='CP437', thread_synchronize=True)¶
A FileSystem that represents a zip file.
Create a FS that maps on to a zip file.
Parameters: - zip_file – a (system) path, or a file-like object
- mode – mode to open zip file, ‘r’ for reading, ‘w’ for writing or ‘a’ for appending
- compression – can be ‘deflated’ (default) to compress data or ‘stored’ to just store date
- allow_zip_64 – set to True to use zip files greater than 2 GB, default is False
- encoding – the encoding to use for unicode filenames
- thread_synchronize – set to True (default) to enable thread-safety
Raises: - fs.errors.ZipOpenError – thrown if the zip file could not be opened
- fs.errors.ZipNotFoundError – thrown if the zip file does not exist (derived from ZipOpenError)
- close()¶
Finalizes the zip file so that it can be read. No further operations will work after this method is called.
- exception fs.zipfs.ZipNotFoundError(msg=None, details=None)¶
Thrown when the requested zip file does not exist
- exception fs.zipfs.ZipOpenError(msg=None, details=None)¶
Thrown when the zip file could not be opened