Skip to main content
This guide opens a native file picker, reads the selected file, and saves a new file to a location the user chooses.
Want to see FileKit before installing it? Try it in your browser: the FileKit sample app runs live, with no install.
1

Add the dependency

FileKit can helps you to display dialogs to the user like file, directory and photo pickers, save dialogs, camera and more. FileKit dialogs are available in two flavors:
Both artifacts include filekit-core. For Compose apps, add filekit-dialogs-compose. To call the dialogs from ViewModels or non-Compose code, filekit-dialogs is enough. See Installation for every module.
2

Initialize FileKit where needed

Most targets work without setup. Android (without Compose), desktop JVM, and Linux or Windows native need one line at startup.
If you only use Compose launchers (remember…Launcher), nothing to do.If you call the suspend dialog APIs (FileKit.openFilePicker()…), register your activity so FileKit can launch dialogs:
MainActivity.kt
3

Pick a file

Restrict the selection with type = FileKitType.Image, FileKitType.Video, or FileKitType.File(extensions = listOf("pdf")). Pick several files with mode = FileKitMode.Multiple(). See File picker for all options.
4

Read it

PlatformFile exposes the same read API on every platform. Read the file once the picker returns it: inside onResult (with scope.launch) in Compose, or after openFilePicker() returns a non-null file:
For an image in Compose, call file.toImageBitmap() or use Coil.
5

Save a file

Ask the user where to save, then write to the returned file:
The file saver is available on Android, iOS, macOS, JVM, and Linux and Windows native, so call it from a non-web source set. Browsers don’t let you choose a save location, so on JS and Wasm use FileKit.download(bytes, fileName) instead. See Files on the web.
That’s a complete round trip. FileKit uses each platform’s native dialog, so the picker looks and behaves the way your users expect.

Where to go next

File operations

List, walk, copy, move, and delete files and folders.

Reading and writing

Text, bytes, and streaming with kotlinx-io for large files.

Gallery and camera

Native photo pickers on Android and iOS, plus camera capture.

Directories

Let users pick a folder and keep access with bookmarks.

Image utilities

Compress and resize images, and save them to the gallery.

Platform support

Check which features each platform supports.