Pick, save, and work with files from shared Kotlin code,
with native dialogs on Android, iOS, and desktop, plus browser pickers on the web.
Documentation · Quickstart · Try it in your browser · Roadmap to 1.0
Add FileKit to your shared module. For a Compose Multiplatform app, one artifact brings the dialogs, the Compose launchers, and the core file API:
// build.gradle.kts
kotlin {
sourceSets {
commonMain.dependencies {
implementation("io.github.vinceglb:filekit-dialogs-compose:0.17.0")
}
}
}Not using Compose, or targeting Linux native, Windows native, or watchOS? Use filekit-dialogs, or filekit-core for file operations only. The platform support matrix shows which module runs where.
Most targets need no setup. On Android, call FileKit.init(activity) if you use the suspend dialog APIs; the Compose launchers work without it. On JVM desktop and Linux or Windows native, call FileKit.init(appId) before using app directories such as FileKit.filesDir. The installation guide covers the version catalog, every module, and each platform.
Pick a file in Compose
val launcher = rememberFilePickerLauncher(
type = FileKitType.Image,
onError = { failure -> println("Picker failed: ${failure.message}") },
) { image ->
// A PlatformFile, or null if the user cancelled
}
Button(onClick = { launcher.launch() }) {
Text("Pick an image")
}Pick files from any coroutine
val files: List<PlatformFile>? = FileKit.openFilePicker(
type = FileKitType.File("pdf", "docx"),
mode = FileKitMode.Multiple(maxItems = 10),
)Save a file where the user chooses
// From a coroutine
val file = FileKit.openFileSaver(suggestedName = "hello", defaultExtension = "txt")
file?.writeString("Hello FileKit!")Work with files
// From a coroutine
val notes = FileKit.filesDir / "notes.txt"
notes.writeString("Hello FileKit!")
println("${notes.name}: ${notes.size()} bytes")
notes.copyTo(FileKit.cacheDir / "notes-backup.txt")The file saver, app directories, and path operations such as / and copyTo aren't available on JS and Wasm. Call them from a non-web source set, and use FileKit.download in the browser.
The quickstart walks through a full pick, read, and save round trip in a few minutes.
| Module | Use it for |
|---|---|
filekit-core |
PlatformFile and file operations (read, write, copy, move, list), app directories, image compression |
filekit-dialogs |
Native file, directory, gallery, and camera pickers and save dialogs, callable from any coroutine |
filekit-dialogs-compose |
Compose Multiplatform launchers such as rememberFilePickerLauncher, plus ImageBitmap helpers |
filekit-coil |
Display a PlatformFile with Coil 3's AsyncImage |
filekit-dialogs-compose includes filekit-dialogs, which includes filekit-core.
| Module | Android | iOS | macOS | JVM desktop | Linux | Windows | watchOS | Web |
|---|---|---|---|---|---|---|---|---|
filekit-core |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ✅ |
filekit-dialogs |
✅ | ✅ | ✅ | ✅ | ✅ | ✅ | ❌ | ✅ |
filekit-dialogs-compose |
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
filekit-coil |
✅ | ✅ | ✅ | ✅ | ❌ | ❌ | ❌ | ✅ |
JVM desktop runs on Windows, macOS, and Linux. The Linux and Windows columns are Kotlin/Native targets, and Web covers JS and Wasm. Some features depend on the platform (browsers don't let you choose a save location, so FileKit offers FileKit.download there). The platform support matrix lists every feature per target.
FileKit is used by Thunderbird, Leboncoin's Spark design system, Gradle Client, Blockstream Green, Square's Workflow trace viewer, the Android FHIR SDK, Animeko, and StreetComplete.
See how each project uses it in the showcase, read what developers say on the wall of love, or add your project.
Bug reports, documentation fixes, and pull requests are welcome. CONTRIBUTING.md explains how to set up the project and which checks to run. For questions and ideas, open a discussion.
FileKit stands on the shoulders of giants. Special thanks to:
- compose-multiplatform-file-picker
- peekaboo
- Calf
- jnafilechooser
- swing-jnafilechooser
- nativefiledialog
- IFileDialogImp
- IntelliJ Community Foundation
- file_picker (flutter)
FileKit is released under the MIT License.
Made with ❤️ by Vince