Skip to content
프로젝트

소개

Kotlin Multiplatform 및 Compose Multiplatform용 파일 작업과 네이티브 파일 선택기입니다. 파일 읽기, 쓰기, 복사 및 목록 표시, 열기 및 저장 대화상자, 이미지 압축, 북마크를 지원합니다. Android, iOS, macOS, JVM 데스크톱, Linux, Windows, JS, Wasm에서 사용할 수 있습니다.

디자인 및 미디어

이 수치를 측정하는 방법

측정된 스타 증가

in 24h
+1
in 7 days
+1
in 15 days
+7
in 1 month
+17

서로 겹치는 기간의 순증가량이며 일별 합계가 아닙니다. 측정값이 없으면 비워 둡니다. 스타는 관심도를 나타내며 품질을 보장하지 않습니다.

README.md

Original
FileKit: file pickers, save dialogs, and file operations for Kotlin Multiplatform and Compose Multiplatform

Pick, save, and work with files from shared Kotlin code,
with native dialogs on Android, iOS, and desktop, plus browser pickers on the web.

Maven Central version Supported platforms: Android, iOS, macOS, JVM, Linux, Windows, Web MIT License Documentation

Documentation  ·  Quickstart  ·  Try it in your browser  ·  Roadmap to 1.0

FileKit is supported by the Kotlin Foundation Grants Program. Read the announcement.

Installation

Add FileKit to your shared module. For a Compose Multiplatform app, one artifact brings the dialogs, the Compose launchers, and the core file API:

// build.gradle.kts
kotlin {
    sourceSets {
        commonMain.dependencies {
            implementation("io.github.vinceglb:filekit-dialogs-compose:0.17.1")
        }
    }
}

Not using Compose, or targeting Linux native, Windows native, or watchOS? Use filekit-dialogs, or filekit-core for file operations only. The platform support matrix shows which module runs where.

Most targets need no setup. On Android, call FileKit.init(activity) if you use the suspend dialog APIs; the Compose launchers work without it. On JVM desktop and Linux or Windows native, call FileKit.init(appId) before using app directories such as FileKit.filesDir. The installation guide covers the version catalog, every module, and each platform.

At a glance

Pick a file in Compose

val launcher = rememberFilePickerLauncher(
    type = FileKitType.Image,
    onError = { failure -> println("Picker failed: ${failure.message}") },
) { image ->
    // A PlatformFile, or null if the user cancelled
}

Button(onClick = { launcher.launch() }) {
    Text("Pick an image")
}

Pick files from any coroutine

val files: List<PlatformFile>? = FileKit.openFilePicker(
    type = FileKitType.File("pdf", "docx"),
    mode = FileKitMode.Multiple(maxItems = 10),
)

Save a file where the user chooses

// From a coroutine
val file = FileKit.openFileSaver(suggestedName = "hello", defaultExtension = "txt")
file?.writeString("Hello FileKit!")

Work with files

// From a coroutine
val notes = FileKit.filesDir / "notes.txt"
notes.writeString("Hello FileKit!")

println("${notes.name}: ${notes.size()} bytes")
notes.copyTo(FileKit.cacheDir / "notes-backup.txt")

The file saver, app directories, and path operations such as / and copyTo aren't available on JS and Wasm. Call them from a non-web source set, and use FileKit.download in the browser.

The quickstart walks through a full pick, read, and save round trip in a few minutes.

Modules

Module Use it for
filekit-core PlatformFile and file operations (read, write, copy, move, list), app directories, image compression
filekit-dialogs Native file, directory, gallery, and camera pickers and save dialogs, callable from any coroutine
filekit-dialogs-compose Compose Multiplatform launchers such as rememberFilePickerLauncher, plus ImageBitmap helpers
filekit-coil Display a PlatformFile with Coil 3's AsyncImage

filekit-dialogs-compose includes filekit-dialogs, which includes filekit-core.

Platform support

Module Android iOS macOS JVM desktop Linux Windows watchOS Web
filekit-core ✅ ✅ ✅ ✅ ✅ ✅ ✅ ✅
filekit-dialogs ✅ ✅ ✅ ✅ ✅ ✅ ❌ ✅
filekit-dialogs-compose ✅ ✅ ✅ ✅ ❌ ❌ ❌ ✅
filekit-coil ✅ ✅ ✅ ✅ ❌ ❌ ❌ ✅

JVM desktop runs on Windows, macOS, and Linux. The Linux and Windows columns are Kotlin/Native targets, and Web covers JS and Wasm. Some features depend on the platform (browsers don't let you choose a save location, so FileKit offers FileKit.download there). The platform support matrix lists every feature per target.

Who's using FileKit

FileKit is used by Thunderbird, Leboncoin's Spark design system, Gradle Client, Blockstream Green, Square's Workflow trace viewer, the Android FHIR SDK, Animeko, and StreetComplete.

See how each project uses it in the showcase, read what developers say on the wall of love, or add your project.

Contributing

Bug reports, documentation fixes, and pull requests are welcome. CONTRIBUTING.md explains how to set up the project and which checks to run. For questions and ideas, open a discussion.

Credits

FileKit stands on the shoulders of giants. Special thanks to:

License

FileKit is released under the MIT License.


Made with ❤️ by Vince

관련 프로젝트 살펴보기

불러오는 중…