Documentation
On this page

Function · Desktop Services

showSaveFileDialog

Displays a native save-file dialog.

@sharpts/gui · SharpTS 572a2e31be0e

Signature

TypeScript
showSaveFileDialog(options: SaveFileDialogOptions = {}): Promise<string | null>

Parameters

NameTypeDescription
optionsSaveFileDialogOptions
Default: {}
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);

Source

src/SharpTS.Gui.Sdk/GuiPackage/runtime.ts:1612 at SharpTS revision 572a2e31be0e2a09be0138bc44501b34d6245b51.