Documentation Index
Fetch the complete documentation index at: https://filekit.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
Supported on Android, iOS, macOS and JVM targets
Quick start
The file saver component provides a native interface for users to choose where to save a file on their device. The file saver dialog returns aPlatformFile object representing where the user wants to save the file. Note that the file is not created automatically - it’s the developer’s responsibility to write the actual data to the file location using methods like write().
Here’s a basic example:
Parameters
The file saver can be customized with several parameters:suggestedName: The default name for the file without extensiondefaultExtension: The default file extension without the dot (e.g., “pdf”, “txt”)allowedExtensions: The allowed save extensions without dots (e.g.,setOf("txt", "md")). This is a native dialog hint, not a validation guarantee.directory: The starting directory for the save dialogdialogSettings: Platform-specific settings for customizing the dialog behavior
defaultExtension for the default file name and default extension. Use allowedExtensions when the native save dialog should offer specific save types. Filtering is applied where the platform supports it; apps that require a specific output format should still validate the returned file extension.
Read more about dialog settings to customize the dialog for each platform.
Writing data
The file saver returns aPlatformFile object representing the selected save location. You can write data to this file using the write() extension function:
Download file on the web
On web targets (JS and WASM), instead of using a file saver dialog, you can directly download a file usingFileKit.download():
On web targets, the file saver dialog is not supported due to browser security restrictions. Instead, use
FileKit.download() to download files directly.