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.
Android setup
When using FileKit Core on Android, you need to initialize it in your application class or main activity:
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/
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.