Repository navigation
BitFileExtractor
The class BitFileExtractor allows extracting archives on the filesystem.
| Return type | Name |
|---|---|
__init__(self, lib: bit7z_python.Bit7zLibrary, format: bit7z_python.BitInFormat = bit7z_python.FORMAT_AUTO) -> None |
|
None |
clear_password(self) -> None |
None |
extract(self, in_archive: str, out_buffer: buffer_t, index: int = 0) -> None 🚫 NOT USABLE
|
None |
extract(self, in_archive: str, callback: collections.abc.Callable, indices: collections.abc.Sequence[int] = []) -> None 🚫 NOT USABLE
|
None |
extract(self, in_archive: str, out_buffer: byte_t*, size: int, index: int = 0) -> None 🚫 NOT USABLE
|
None |
extract(self, in_archive: str, out_buffer: byte_t(&)[N], index: int = 0) -> None 🚫 NOT USABLE
|
None |
extract(self, in_archive: str, out_dir: str, callback: collections.abc.Callable[[bit7z_python.BitArchiveItem], str]) -> None |
None |
extract(self, in_archive: str, out_dir: str = '') -> None |
None |
extract(self, in_archive: str, out_buffer: std::array< byte_t, N >&, index: int = 0) -> None 🚫 NOT USABLE
|
None |
extract(self, in_archive: str, out_map: std::map< str, buffer_t >) -> None 🚫 NOT USABLE
|
None |
extract(self, in_archive: str, out_stream: std::ostream, index: int = 0) -> None 🚫 NOT USABLE
|
None |
extract_folder(self, in_archive: str, out_dir: str, folder_path: str, policy: bit7z_python.FolderPathPolicy = bit7z_python.FolderPathPolicy.Strip) -> None |
None |
extract_if(self, in_archive: str, out_buffer: buffer_t, callback: collections.abc.Callable[[bit7z_python.BitArchiveItem], bit7z_python.FilterResult]) -> None 🚫 NOT USABLE
|
None |
extract_if(self, in_archive: str, out_dir: str, callback: collections.abc.Callable[[bit7z_python.BitArchiveItem], bit7z_python.FilterResult]) -> None |
bit7z_python.BitInFormat |
extraction_format(self) -> bit7z_python.BitInFormat |
None |
extract_items(self, in_archive: str, indices: collections.abc.Sequence[int], out_dir: str = '') -> None |
None |
extract_matching(self, in_archive: str, item_filter: str, out_buffer: buffer_t, policy: bit7z_python.FilterPolicy = bit7z_python.FilterPolicy.Include) -> None 🚫 NOT USABLE
|
None |
extract_matching(self, in_archive: str, item_filter: str, out_dir: str = '', policy: bit7z_python.FilterPolicy = bit7z_python.FilterPolicy.Include) -> None |
None |
extract_matching_regex(self, in_archive: str, regex: str, out_buffer: buffer_t, policy: bit7z_python.FilterPolicy = bit7z_python.FilterPolicy.Include) -> None 🚫 NOT USABLE
|
None |
extract_matching_regex(self, in_archive: str, regex: str, out_dir: str = '', policy: bit7z_python.FilterPolicy = bit7z_python.FilterPolicy.Include) -> None |
None |
extract_root_folder_content(self, in_archive: str, out_dir: str) -> None |
None |
extract_to(self, in_archive: str, callback: collections.abc.Callable, indices: collections.abc.Sequence[int] = []) -> None 🚫 NOT USABLE
|
collections.abc.Callable[[str], None] |
file_callback(self) -> collections.abc.Callable[[str], None] |
bit7z_python.BitInFormat |
format(self) -> bit7z_python.BitInFormat |
bool |
is_password_defined(self) -> bool |
bit7z_python.Bit7zLibrary |
library(self) -> bit7z_python.Bit7zLibrary |
bit7z_python.OverwriteMode |
overwrite_mode(self) -> bit7z_python.OverwriteMode |
str |
password(self) -> str |
collections.abc.Callable[[], str] |
password_callback(self) -> collections.abc.Callable[[], str] |
collections.abc.Callable[[int], bool] |
progress_callback(self) -> collections.abc.Callable[[int], bool] |
collections.abc.Callable[[int, int], None] |
ratio_callback(self) -> collections.abc.Callable[[int, int], None] |
bool |
retain_directories(self) -> bool |
None |
set_file_callback(self, callback: collections.abc.Callable[[str], None]) -> None |
None |
set_overwrite_mode(self, mode: bit7z_python.OverwriteMode) -> None |
None |
set_password(self, password: str) -> None |
None |
set_password_callback(self, callback: collections.abc.Callable[[], str]) -> None |
None |
set_progress_callback(self, callback: collections.abc.Callable[[int], bool]) -> None |
None |
set_ratio_callback(self, callback: collections.abc.Callable[[int, int], None]) -> None |
None |
set_retain_directories(self, retain: bool) -> None |
None |
set_total_callback(self, callback: collections.abc.Callable[[int], None]) -> None |
None |
test(self, in_archive: str, indices: collections.abc.Sequence[int] = []) -> None |
collections.abc.Callable[[int], None] |
total_callback(self) -> collections.abc.Callable[[int], None] |
def init(self, lib: bit7z_python.Bit7zLibrary, format: bit7z_python.BitInFormat = bit7z_python.FORMAT_AUTO) -> None: ...
Constructs a BitExtractor object. The Bit7zLibrary parameter is needed to have access to the functionalities of the 7z DLLs. On the contrary, the BitInFormat is required to know the format of the in_file archives.
Note
When bit7z is compiled using the BIT7Z_AUTO_FORMAT macro define, the format argument has the default value BitFormat::Auto (automatic format detection of the in_file archive). Otherwise, when BIT7Z_AUTO_FORMAT is not defined (i.e., no auto format detection available), the format argument must be specified.
Parameters:
- lib: the 7z library to use.
- format: the in_file archive format.
Clear the current password used by the handler. Calling clearPassword() will disable the encryption/decryption of archives.
Note
This is equivalent to calling setPassword(L"").
🚫 NOT USABLE
Extracts a file from the given archive to the output buffer.
Parameters:
- in_archive: the input archive to extract from.
- out_buffer: the output buffer where the content of the extracted file will be put.
- index: the index of the file to be extracted from the archive.
🚫 NOT USABLE
Extracts the content of the given archive to the buffers provided by the given BufferCallback.
Parameters:
- in_archive: the input archive to be extracted.
- callback: the function providing the buffers.
- indices: (optional) the indices of the files in the archive that must be extracted.
🚫 NOT USABLE
Extracts a file to the pre-allocated output buffer.
Parameters:
- in_archive: the input archive to extract from.
- out_buffer: the pre-allocated output buffer.
- size: the size of the output buffer (it must be equal to the unpacked size of the item to be extracted).
- index: the index of the file to be extracted.
🚫 NOT USABLE
Extracts a file to the pre-allocated output buffer.
Parameters:
- in_archive: the input archive to extract from.
- out_buffer: the pre-allocated output buffer.
- index: the index of the file to be extracted.
Extracts the given archive to the chosen directory, renaming the extracted items using the provided RenameCallback.
Note
The callback receives the archive item being extracted and must return the path that the extracted item must have on the filesystem. If the path of the item must not change, simply return the item's path in the callback. If the item must not be extracted, return an empty string in the callback.
Parameters:
- in_archive: the input archive to be extracted.
- out_dir: the output directory where extracted files will be put.
- callback: the callback to be used for renaming the extracted items.
Extracts the given archive to the chosen directory.
Parameters:
- in_archive: the input archive to be extracted.
- out_dir: the output directory where extracted files will be put.
Extracts a file to the pre-allocated output buffer.
Parameters:
- in_archive: the input archive to extract from.
- out_buffer: the pre-allocated output buffer.
- index: the index of the file to be extracted.
🚫 NOT USABLE
Extracts the content of the given archive into a map of memory buffers, where the keys are the paths of the files (inside the archive), and the values are their decompressed contents.
Parameters:
- in_archive: the input archive to be extracted.
- out_map: the output map.
🚫 NOT USABLE
Extracts a file from the given archive to the output stream.
Parameters:
- in_archive: the input archive to extract from.
- out_stream: the (binary) stream where the content of the extracted file will be put.
- index: the index of the file to be extracted from the archive.
def extract_folder(self, in_archive: str, out_dir: str, folder_path: str, policy: bit7z_python.FolderPathPolicy) -> None: ...
Extracts a folder from the archive to the chosen directory.
Parameters:
- in_archive: the input archive to extract from.
- out_dir: the output directory where the extracted folder will be put.
- folder_path: the path of the folder inside the archive to be extracted.
- policy: (optional) the path policy to be used for extracting the folder.
🚫 NOT USABLE
Extracts to the output buffer the first item satisfying the given filtering criteria.
Parameters:
- in_archive: the input archive to extract from.
- out_buffer: the output buffer where the extracted file will be put.
- callback: the filtering callback that specifies whether to extract an item or not.
Extracts to the output directory all the items that satisfy the given filtering criteria.
Parameters:
- in_archive: the input archive to extract from.
- out_dir: the output directory where extracted files will be put.
- callback: the filtering callback that specifies whether to extract an item or not.
Returns the archive format used by the archive opener.
Extracts the specified items from the given archive to the chosen directory.
Parameters:
- in_archive: the input archive to extract from.
- indices: the indices of the files in the archive that should be extracted.
- out_dir: the output directory where the extracted files will be placed.
def extract_matching(self, in_archive: str, item_filter: str, out_buffer: buffer_t, policy: bit7z_python.FilterPolicy) -> None: ...
🚫 NOT USABLE
Extracts from the archive to the output buffer the first file whose path matches the given wildcard pattern.
Parameters:
- in_archive: the input archive to extract from.
- item_filter: the wildcard pattern used for matching the paths of files inside the archive.
- out_buffer: the output buffer where to extract the file.
- policy: the filtering policy to be applied to the matched items.
def extract_matching(self, in_archive: str, item_filter: str, out_dir: str, policy: bit7z_python.FilterPolicy) -> None: ...
Extracts from the archive to the output directory all the items whose paths match the given wildcard pattern.
Parameters:
- in_archive: the input archive to extract from.
- item_filter: the wildcard pattern used for matching the paths of files inside the archive.
- out_dir: the output directory where extracted files will be put.
- policy: the filtering policy to be applied to the matched items.
def extract_matching_regex(self, in_archive: str, regex: str, out_buffer: buffer_t, policy: bit7z_python.FilterPolicy) -> None: ...
Extracts from the archive to the output buffer the first file whose path matches the given regex pattern.
🚫 NOT USABLE
Note
Available only when compiling bit7z using the BIT7Z_REGEX_MATCHING preprocessor define. We have enabled this option.
Parameters:
- in_archive: the input archive to extract from.
- regex: the regex used for matching the paths of files inside the archive.
- out_buffer: the output buffer where the extracted file will be put.
- policy: the filtering policy to be applied to the matched items.
def extract_matching_regex(self, in_archive: str, regex: str, out_dir: str, policy: bit7z_python.FilterPolicy) -> None: ...
Extracts from the archive to the output directory all the items whose paths match the given regex pattern.
Note
Available only when compiling bit7z using the BIT7Z_REGEX_MATCHING preprocessor define. We have enabled this option.
Parameters:
- in_archive: the input archive to extract from.
- regex: the regex used for matching the paths of files inside the archive.
- out_dir: the output directory where extracted files will be put.
- policy: the filtering policy to be applied to the matched items.
Extracts the content of the archive's root folder to the chosen directory. The archive's root folder is the single top-level folder shared by all the items in the archive; its name is stripped from the extracted items' paths.
Note
If the archive does not have a single root folder, a BitException is thrown.
Parameters:
- in_archive: the input archive to extract from.
- out_dir: the output directory where the root folder's content will be put.
Extracts the raw content of the archive to the given callback.
Note
You can set a FileCallback to check the file being extracted.
Parameters:
- in_archive: the input archive to be extracted.
- callback: a function providing the extracted raw data to the user.
- indices: (optional) the indices of the files in the archive that must be extracted.
Returns the current file callback.
Returns the archive format used by the archive opener.
Returns a boolean value indicating whether a password is defined or not.
Returns the Bit7zLibrary object used by the handler.
Returns the current OverwriteMode.
Returns the password used to open, extract, or encrypt the archive.
Returns the current password callback.
Returns the current progress callback.
Returns the current ratio callback.
Returns a boolean value indicating whether the directory structure must be preserved while extracting or compressing the archive.
Sets the function to be called when the current file being processed changes.
Parameters:
- callback: the file callback to be used.
Sets how the handler should behave when it tries to output to an existing file or buffer.
Parameters:
- mode: the OverwriteMode to be used by the handler.
Sets up a password to be used by the archive handler. The password will be used to encrypt/decrypt archives by using the default cryptographic method of the archive format.
Note
Calling setPassword when the input archive is not encrypted does not have any effect on the extraction process.
Note
Calling setPassword when the output format doesn't support archive encryption (e.g., GZip, BZip2, etc...) does not have any effects (in other words, it doesn't throw exceptions, and it has no effects on compression operations).
Note
After a password has been set, it will be used for every subsequent operation. To disable the use of the password, you need to call the clearPassword method, which is equivalent to calling setPassword(L"").
Parameters:
- password: the password to be used.
Sets the function to be called when a password is needed to complete the ongoing operation.
Parameters:
- callback: the password callback to be used.
Sets the function to be called when the processed size of the ongoing operation is updated.
Note
The completion percentage of the current operation can be obtained by calculating static_cast<int>((100.0 * processed_size) / total_size).
Parameters:
- callback: the progress callback to be used.
Sets the function to be called when the input processed size and current output size of the ongoing operation are known.
Note
The ratio percentage of a compression operation can be obtained by calculating static_cast<int>((100.0 * output_size) / input_size).
Parameters:
- callback: the ratio callback to be used.
Sets whether the operations' output will preserve the input's directory structure or not.
Parameters:
- retain: the setting for preserving or not the input directory structure
Sets the function to be called when the total size of an operation is available.
Parameters:
- callback: the total callback to be used.
Tests the given archive without extracting its content. If the archive is not valid, a BitException is thrown.
Parameters:
- in_archive: the input archive to be tested.
- indices: (optional) the indices of the items to be tested in the archive.
Returns the current total callback.