FileKit Core
PlatformFile
Cross-platform file representation for Kotlin Multiplatform
Supported on Android, iOS, macOS, JVM, JS and WASM targets
Introduction
PlatformFile
is the core class in FileKit that provides a unified representation of files across all platforms. It abstracts away platform-specific file implementations and provides a consistent API for working with files in your Kotlin Multiplatform project.
Creating a PlatformFile
You can create a PlatformFile
instance in several ways:
Platform-specific constructors
Each platform also provides specific constructors:
Properties
PlatformFile
provides several properties to access file information:
File operations
PlatformFile
provides methods for common file operations:
Working with directories
You can use the resolve
method or the /
operator to navigate through directories:
Converting to kotlinx-io
PlatformFile
provides built-in integration with kotlinx-io.