On this page
Desktop file I/O bridge for pywebview.
#server.src.pixelweaver.bridge
#server.src.pixelweaver.bridge
Desktop file I/O bridge for pywebview.
Provides native file dialogs and filesystem access callable from JavaScript via pywebview's js_api mechanism. All binary data is transferred as base64-encoded strings since the JS bridge serializes return values as JSON.
#DesktopBridge
File I/O bridge exposed to the frontend via pywebview js_api.
Methods on this class become callable from JavaScript as: window.pywebview.api.method_name(args)
#save_file
def save_file(self, data_b64: str, default_name: str, filter_name: str, extensions: list[str]) -> str | NoneShow a native Save dialog and write the file.
Returns the saved file path, or None if the user cancelled.
#open_file
def open_file(self, filter_name: str, extensions: list[str]) -> dict | NoneShow a native Open dialog and read the file.
Returns {"path": str, "data": base64_string} or None if cancelled.
#write_file
def write_file(self, path: str, data_b64: str) -> boolWrite binary data to a specific path (no dialog).
#pick_directory
def pick_directory(self) -> str | NoneShow a native directory picker. Returns path or None if cancelled.
#write_files_to_directory
def write_files_to_directory(self, dir_path: str, files: list[dict]) -> boolWrite multiple files to a directory.
Each entry in files should be {"name": str, "data": base64_string}.