nvflare.fuel.utils.zip_utils module¶
- get_all_file_paths(directory)[source]¶
Gets all file paths in the directory.
- Parameters:
directory – directory to get all paths for
- Returns:
A list of paths of all the files in the provided directory
- ls_zip_from_bytes(zip_data: bytes)[source]¶
Returns info of a zip.
- Parameters:
zip_data – the input zip data
- normpath_for_zip(path)[source]¶
Normalizes the path for zip file.
- Parameters:
path (str) – the path to be normalized
- split_path(path: str) -> (<class 'str'>, <class 'str'>)[source]¶
Splits a path into a pair of head and tail.
It removes trailing os.path.sep and call os.path.split
- Parameters:
path – Path to split
- Returns:
A tuple of (head, tail)
- unzip_all_from_bytes(zip_data: bytes, output_dir_name: str)[source]¶
Decompresses a zip and extracts all files to the specified output directory.
- Parameters:
zip_data – the input zip data
output_dir_name – the output directory for extracted content
- unzip_single_file_from_bytes(zip_data: bytes, output_dir_name: str, file_path: str)[source]¶
Decompresses a zip and extracts single specified file to the specified output directory.
- Parameters:
zip_data – the input zip data
output_dir_name – the output directory for extracted content
file_path – file path to file to unzip