Targets per module
Intel-only Apple targets (
iosX64, macosX64) are not published.
FileKit Core
Columns: And Android · iOS · mac macOS · JVM JVM desktop · Lin Linux native · Win Windows native · watch watchOS · Web JS and Wasm.FileKit Dialogs
filekit-dialogs is not available on watchOS. Web means JS and Wasm.
Compose and Coil
Compose Multiplatform has no Linux native, Windows native, or watchOS targets, so
filekit-dialogs-compose and filekit-coil don’t either. On macOS native, Compose itself is experimental.
Use platform-specific APIs from shared code
Kotlin’s default hierarchy gives youappleMain, iosMain, nativeMain, and webMain, but no source set for “everything except the web” or “Android and iOS”. Create them in your shared module, following Kotlin’s guide to additional source sets:
build.gradle.kts
macosMain or linuxMain) the same way. Kotlin doesn’t support a source set shared only by Android and JVM: if those are your only non-web targets, call these APIs from androidMain and jvmMain, or wrap them in an expect/actual function. Code in nonWebMain can then call FileKit.openFileSaver(), and code in mobileMain can call FileKit.openCameraPicker().
Notes
- Web files are read-only browser handles. Directories report a size of
0.list,walk, andsizeRecursivelywork on folders returned by the directory picker. - Web writing is experimental.
write,writeString, anddeletework only on entries in the browser’s origin private file system (OPFS) and require@OptIn(ExperimentalFileKitApi::class)and a secure context. Writing to a picked file throws. - Android
content://files:atomicMovefalls back to copy-then-delete and doesn’t support directories. - Linux native:
createdAt()always returnsnull. - macOS native: the output size of
compressImagedepends on the screen’s backing scale factor. - Throws at runtime on these targets:
compressImageon Linux native, Windows native, and watchOS; gallery saving on watchOS returns a failedResult. - Desktop “gallery”: the image or video is written to the user’s Pictures or Videos folder.
- Path-based bookmarks: on Windows, Linux, and non-macOS JVM, bookmark data stores the file path. Access is not security-scoped, so the bookmark breaks if the file moves.
- JVM dialogs use
NSOpenPanel/NSSavePanelon macOS,IFileDialogon Windows, and the XDG Desktop Portal on Linux, falling back to AWT/Swing dialogs when no portal is running. - Linux native dialogs require a running XDG Desktop Portal (
org.freedesktop.portal.Desktop, available on GNOME, KDE, and most modern desktops) andlibdbus-1. There is no fallback dialog and no parent window. See Dialogs setup. - Web picker uses
<input type="file">. The type filter is applied through theacceptattribute;directoryand dialog settings are ignored. - Media types outside Android and iOS open the regular file dialog filtered by extension:
png,jpg,jpeg,gif,bmpfor images andmp4,mov,avi,mkv,webmfor videos. On the web, they filter withimage/*andvideo/*. - Web directory picker returns a read-only tree of the selected folder. An empty folder returns
null, like a cancellation. - Mobile savers: on Android, several
allowedExtensionsfall back to the*/*MIME type. On iOS,allowedExtensionsis ignored. - iOS dialog settings: the presenter view controller and asset representation mode are applied;
titleandcanCreateDirectoriesare currently ignored. - Web serialization compiles but fails:
PlatformFileSerializeris declared for JS and Wasm, but serializing or deserializing aPlatformFilethrows at runtime. Store something else, such as the file name or bytes.