FileKit v0.10 is a full rewrite of the library. It introduces a new API that is more consistent and easier to use. Also, it introduces new concepts that make it easier to work with files and directories on different platforms.

Migration Steps

1

Package names changed

The package names have been renamed to match the new API.

// filekit-core renamed to filekit-dialogs
implementation("io.github.vinceglb:filekit-core:0.8.8")
implementation("io.github.vinceglb:filekit-dialogs:0.10.0-beta01")

// filekit-compose renamed to filekit-dialogs-compose
implementation("io.github.vinceglb:filekit-compose:0.8.8")
implementation("io.github.vinceglb:filekit-dialogs-compose:0.10.0-beta01")

The filekit-core package still exists but it only contains the core functionality of the library like PlatformFile without any dialogs capabilities.

Check the Installation page to learn more about the different modules.

2

Renamed methods

Some methods have been renamed to match the new API. Also, some arguments may have been changed but the behavior is the same.

// Before
FileKit.pickFile()
FileKit.pickDirectory()
FileKit.saveFile()

// After
FileKit.openFilePicker()
FileKit.openDirectoryPicker()
FileKit.openFileSaver()

Read more about the new API in the FileKit Dialogs documentation.

3

Changes in the saving file feature

FileKit.openFileSaver() does not accept taking bytes as parameter. Now, it only returns the path where the user has chosen to save the file. We can now use the returned PlatformFile to save the bytes to the file.

// Before
FileKit.saveFile(bytes)

// After
val file = FileKit.openFileSaver()
file?.write(bytes)

On web targets, opening the file saver is not possible anymore due to browser limitations. Instead, FileKit provides a download() function that can be used to download a file from the web.

FileKit.download(bytes, "file.txt")

Take a look at the Writing files documentation to learn more about the new API.

Feedback

FileKit v0.10 is a major rewrite of the library. If you have any feedback, suggestions or questions, please let me know by opening a discussion on GitHub.

Also, if you find any issues, please open an issue on GitHub.