Function · Desktop Services
showSaveFileDialog
Displays a native save-file dialog.
@sharpts/gui · SharpTS 572a2e31be0eSignature
TypeScript
showSaveFileDialog(options: SaveFileDialogOptions = {}): Promise<string | null>Parameters
| Name | Type | Description |
|---|---|---|
options | SaveFileDialogOptionsDefault: {} | Title, suggested name, extension, and filter options. |
Returns
Promise<string | null> — The selected file path, or null when canceled.
Remarks
The returned value is a local filesystem path. The operating system controls overwrite confirmation and the final presentation.
Throws
- When no desktop window is available, filters are invalid, or the native picker fails.
Examples
TypeScript
import { showSaveFileDialog } from "@sharpts/gui";
const path = await showSaveFileDialog({
suggestedFileName: "report.txt",
defaultExtension: "txt"
});
if (path !== null) console.log(path);Related symbols
Source
src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1612 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.