Function · Desktop Services
showOpenFileDialog
Displays a native open-file dialog.
@sharpts/gui · SharpTS 572a2e31be0eSignature
TypeScript
showOpenFileDialog(options: OpenFileDialogOptions = {}): Promise<string[]>Parameters
| Name | Type | Description |
|---|---|---|
options | OpenFileDialogOptionsDefault: {} | Title, multi-select, and filter options. |
Returns
Promise<string[]> — The selected file paths, or an empty array when canceled.
Remarks
Returned paths are local filesystem paths. Files exposed only through a virtual storage provider are omitted.
Throws
- When no desktop window is available, filters are invalid, or the native picker fails.
Examples
TypeScript
import { showOpenFileDialog } from "@sharpts/gui";
const paths = await showOpenFileDialog({
allowMultiple: true,
filters: [{ name: "Images", patterns: ["*.png", "*.jpg"] }]
});
for (const path of paths) console.log(path);Related symbols
Source
src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1491 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.