Setup
Setup FileKit Core in your Kotlin Multiplatform project
Installation
FileKit provides a platform-agnostic file abstraction called PlatformFile
. It allows you to work with files in a platform-agnostic way. You can create, read, write, and delete files using the PlatformFile
API.
You can use PlatformFile
in your project by adding the following dependency:
FileKit Core provides the fundamental file operations for your Kotlin Multiplatform project. It’s designed to work across all supported platforms with a unified API.
Platform-specific setup
FileKit Core is designed to work out of the box for most platforms, but some targets require additional setup.
JVM setup
FileKit needs to have your application id to handle the app directory. Your application id is generally the package name or the name of your application. FileKit will use this appId
as app directory.
We recommend you to initialize FileKit in your main.kt
file:
The application ID is used to create user-specific directories on different operating systems:
- Windows:
%APPDATA%\your.application.id\
- macOS:
~/Library/Application Support/your.application.id/
- Linux:
~/.local/share/your.application.id/
Android setup
FileKit Core is automatically initialized in Android applications. It uses App Startup to initialize the library, ensuring that it is ready to use when your app starts.
If for some reason you want to disable App Startup in your app, you can initialize FileKit manually by calling FileKit.manualFileKitCoreInitialization(context)
in your MainActivity
or Application
class.
iOS, macOS, JS, WASM setup
No additional setup is needed for iOS, macOS, JS, and WASM targets. FileKit Core works out of the box on these platforms.