Hi guys, I’m pleased to share with you FileKit :sm...
# feed
v
Hi guys, I’m pleased to share with you FileKit 😄 FileKit is a Files, Medias, Folder Picker and File saver library for Kotlin Multiplatform and Compose Multiplatform • Multiplatform: Android, iOS, macOS, JVM, WASM and Js • Native: it uses the native UI on each platform • Lightweight: it depends on the bare minimum dependencies as possible • Media picker: takes advantage of the media picker feature on Android and iOS • Easy to use: pick a file with a single line of code and get information about it from common code • Customizable: choose files by type, filter by extensions, customize initial directory and much more Get started here: https://github.com/vinceglb/FileKit Thank you ❤️
🔥 14
K 3
❤️ 2
K 32
🐕 11
u
Awesome 🤩
kodee happy 1
o
Is there a plan (or I missed an option) to open multiple files/folders at once? So that callback gets
List<PlatformFile>
Also, is it possible to change
rememberFileSaverLauncher
so that it doesn't require bytes on
launch
, but rather hands me path to
onResult
so that I can decide what to do myself when the user chooses a path?
v
@orangy Sure, it's possible to pick multiple files at once by putting mode to
PickerMode.Multiple
, the result is automatically casted to
List<PlatformFile>
. But we can select only one folder at the same time. About the possibility to not pass bytes when calling the file saver, it's a good idea and definitively possible to implement! I'm going to look into it next days.
👍 1
s
Thanks for sharing this! I like the API and the separation into a pure Kotlin and a Compose package. That’s useful. 👍 I gave it a try and for me it works as good as compose-multiplatform-file-picker; unfortunately with the same issues. 😄 I will look into the features it provides in addition to the other project. Maybe I can replace some of some stuff I solved on my own in Ashampoo Photo Organizer. It’s always better to have a proper library doing stuff that does not need to be done in the end user product.
🚀 1
v
Thank you @Stefan Oltmann for giving it a try! Yeah, there are some room for improvement 😄 I just saw your issues, I'll try to look into them this week! If you have some feedbacks later or bugs, don't hesitate to send a message 👌
@orangy I just publish a new version (0.6.0). The
bytes
parameter is now optional when saving a file. It'll create an empty file in that case. It's working on all platform except on the web (WASM / Js). Here is the doc about it: doc
o
Thanks, though I'd avoid creating a file if bytes were not provided – I might want to pick a name without touching a file system. But not sure there is a real use case for this. Anyway, so far it's the best file picker I ever had to use 🙂 I don't have to invent my own anymore
❤️ 1
v
Yeah, you're right, it's even better if the file isn't created! My only concern is that if we call
readBytes()
or
getSize()
on the returned platform file, it will crash. But I supposed it is the responsibility of the developer to prevent that case? I'll probably do the modification 👌 Thank you so much for your comment, I glad to contribute to the community kodee happy
o
You can add
exists
check on the platform file to cover these cases. And make it a contract - no file is created/modified, we just give you a path. Kinda symmetrical to picking a file, you don’t read it and give user bytes, do you?
I’d totally remove bytes parameter tbh.
👍 1
s
Uh, https://github.com/Wavesonics/compose-multiplatform-file-picker just got archived. 👀 Looks like I need to switch to FileKit now.
p
Hi, @Vincent! Nice library! It would be awesome if also using some kind of streaming while saving file (better suspendable) instead of byte array. Use case is downloading data by chunks from server and writing to local file. File can be huge to keep all content at once in byte array.
s
Looks like something you should create an issue for
p
196 Views