PlatformFile, and you write your data to it. The file saver is not available on the web, so call it from a non-web source set such as nonWebMain (see shared source sets).
Usage
null when the user cancels. Failures go to onError in Compose, or are thrown as a FileKitDialogException by the suspend API. See Results and errors.
Options
String
required
launch()
File name without the extension.
String?
default:"null"
launch()
Extension without the dot, appended to
suggestedName.Set<String>?
default:"null"
launch()
Save types offered by the dialog, without dots. A hint, not a validation.
PlatformFile?
default:"null"
launch()
Initial folder. Ignored on Android.
FileKitDialogSettings
default:"createDefault()"
rememberFileSaverLauncher
Required by the Compose launcher. In a Compose Desktop
Window, WindowScope.rememberFileSaverLauncher makes it optional and parents the dialog to the window. See Dialog settings.Offer several file types
PassallowedExtensions to let the user pick a format. defaultExtension stays the preselected one:
file.extension if your app needs a specific format.
Download file on the web
Browsers don’t let you choose a save location: useFileKit.download to send bytes to the user’s downloads folder instead. See Download files.
Platform notes
Upgrading from older versions
Upgrading from older versions
The
extension parameter of openFileSaver and launch() is deprecated. Rename it to defaultExtension; the behavior is the same.Related
- Writing files for streaming large content.
- Dialog settings for titles and parent windows.