https://github.com/vinceglb/filekit
Pick and save Files, Medias and Folder for Kotlin Multiplatform / KMP and Compose Multiplatform / CMP
https://github.com/vinceglb/filekit
compose compose-multiplatform kmp kotlin kotlin-android kotlin-ios kotlin-js kotlin-jvm kotlin-macos kotlin-multiplatform kotlin-wasm
Last synced: 24 days ago
JSON representation
Pick and save Files, Medias and Folder for Kotlin Multiplatform / KMP and Compose Multiplatform / CMP
- Host: GitHub
- URL: https://github.com/vinceglb/filekit
- Owner: vinceglb
- License: mit
- Created: 2024-04-04T21:12:55.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-10-22T22:28:49.000Z (6 months ago)
- Last Synced: 2024-10-24T06:27:48.690Z (6 months ago)
- Topics: compose, compose-multiplatform, kmp, kotlin, kotlin-android, kotlin-ios, kotlin-js, kotlin-jvm, kotlin-macos, kotlin-multiplatform, kotlin-wasm
- Language: Kotlin
- Homepage: https://vinceglb.github.io/FileKit/
- Size: 826 KB
- Stars: 545
- Watchers: 7
- Forks: 16
- Open Issues: 18
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
![]()
FileKit
ð A powerful cross-platform file operations library for Kotlin Multiplatform
![]()
![]()
![]()
![]()
![]()
## âĻ Features
- ðą **Cross-Platform Support**: Works seamlessly on Android, iOS, macOS, JVM (Windows, macOS, Linux), JS, and WASM
- ðŊ **Native Experience**: Uses platform-native file pickers for the best user experience
- ðŠķ **Lightweight**: Minimal dependencies to keep your app fast and lean
- ð **Rich Integrations**: Works with Compose Multiplatform, Coroutines, kotlinx-io, Coil, and more
- ð **Comprehensive File Operations**: Pick files, save documents, access photos, manage directories
- ðĻ **Image Utilities**: Built-in image compression and gallery integration## ð Documentation
Visit our [documentation](https://filekit.mintlify.app) to learn more: https://filekit.mintlify.app
- [FileKit Introduction](https://filekit.mintlify.app/introduction)
- [Getting Started Guide](https://filekit.mintlify.app/quickstart)
- [Core API Documentation](https://filekit.mintlify.app/core/setup)
- [Dialogs Documentation](https://filekit.mintlify.app/dialogs/setup)> Migrate from FileKit 0.8 to 0.10 by following the [migration guide](https://filekit.mintlify.app/migrate-to-v0.10).
## ð Quick Start
### Installation
```kotlin
// build.gradle.kts
dependencies {
implementation("io.github.vinceglb:filekit-core:$version")
implementation("io.github.vinceglb:filekit-dialogs:$version")
implementation("io.github.vinceglb:filekit-dialogs-compose:$version")
implementation("io.github.vinceglb:filekit-coil:$version")
}
```Follow the [installation guide](https://filekit.mintlify.app/installation) to learn how to install and setup FileKit in your project.
### Usage Examples
```kotlin
// Pick a file
val file = FileKit.openFilePicker()// Pick multiple files
val files = FileKit.openFilePicker(mode = FileKitMode.Multiple())// Pick only images
val imageFile = FileKit.openFilePicker(type = FileKitType.Image)// Pick a directory
val directory = FileKit.openDirectoryPicker()// Save a file
val contentToSave = "Hello FileKit!"
val file = FileKit.openFileSaver(suggestedName = "document", extension = "txt")
file?.writeString(contentToSave)// Work with files
val myFile = FileKit.filesDir / "document.pdf"
println(myFile.name)
println(myFile.size())
myFile.writeString("Hello, World!")// Image operations
val compressedBytes = FileKit.compressImage(
bytes = imageFile.readBytes(),
quality = 80,
maxWidth = 1024,
maxHeight = 1024
)
```See the [quickstart guide](https://filekit.mintlify.app/quickstart) to learn more about the different file operations and utilities available in FileKit.
## ðĶ Modular Structure
FileKit is designed to be modular, allowing you to include only what you need:
- **FileKit Core**: Basic file operations and the `PlatformFile` abstraction
- **FileKit Dialogs**: File pickers and save dialogs
- **FileKit Dialogs Compose**: Compose Multiplatform integration
- **FileKit Coil**: Integration with Coil for image loading
## ð Credits
FileKit stands on the shoulders of giants. Special thanks to:
- [compose-multiplatform-file-picker](https://github.com/Wavesonics/compose-multiplatform-file-picker)
- [peekaboo](https://github.com/onseok/peekaboo)
- [Calf](https://github.com/MohamedRejeb/Calf)
- [jnafilechooser](https://github.com/steos/jnafilechooser)
- [swing-jnafilechooser](https://github.com/DJ-Raven/swing-jnafilechooser)
- [nativefiledialog](https://github.com/mlabbe/nativefiledialog)
- [IFileDialogImp](https://github.com/dbwiddis/IFileDialogImp)
- [IntelliJ Community Foundation](https://github.com/JetBrains/intellij-community/blob/master/platform/util/ui/src/com/intellij/ui/mac/foundation/Foundation.java)
- [file_picker (flutter)](https://pub.dev/packages/file_picker)---