FileManager#
- class ansys.sam.sysml2.diagrams.utils.file_manager.FileManager#
Handles file operations and path management.
Overview#
Save binary content to a file. |
|
Save streamed response content to a file. |
|
Resolve a valid file path from the given path and default filename. |
|
Ensure that a directory exists. Create it if needed. |
Import detail#
from ansys.sam.sysml2.diagrams.utils.file_manager import FileManager
Method detail#
- static FileManager.save_binary_content(content: bytes, path: str | pathlib.Path, filename: str, file_format: str) pathlib.Path#
Save binary content to a file.
- static FileManager.save_response_content(response: requests.Response, path: str | pathlib.Path, filename: str) pathlib.Path#
Save streamed response content to a file.
- static FileManager.resolve_file_path(path: str | pathlib.Path, filename: str) pathlib.Path#
Resolve a valid file path from the given path and default filename.
If a file is specified, use its parent directory and concatenate with the filename.
- Parameters:
- Returns:
PathResolved file path.
- Raises:
ValueErrorIf the path cannot be resolved properly.
- static FileManager.ensure_directory_exists(directory_path: pathlib.Path) None#
Ensure that a directory exists. Create it if needed.
- Parameters:
- directory_path
Path Directory to check or create.
- directory_path