Skip to main content

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

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.

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:
main.kt
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/

Custom Cache and Data Directories

For applications that need custom directory paths (e.g., portable applications or specific deployment scenarios), you can specify custom cache and data directories:
main.kt

ProGuard Configuration

If you’re using ProGuard or code obfuscation on JVM platforms, add the relevant rules to your proguard-rules.pro:

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.