byteunits
byteunits copied to clipboard
Kotlin Multiplatform support
Formatting support could be extension functions on JVM/Android. I don't have an idea how to do it on native though
Happy to do this if I can find the time.
Probably want to do this in some typical steps (which each might have a few PRs):
- Gradle
- GitHub Actions
- Kotlin JVM only
- Kotlin MPP
I'm happy to accept PRs for this stuff. The smaller and more focused the easier it is for me to review and smash the merge button.
Regarding formatting, what's your desired API?
Should we have fun format(bytes: Long, pattern: String): String in commonMain and then use DecimalFormat(pattern) via expect/actual all the way for all targets?
And:
@JvmOverloads fun format(
bytes: Long,
format: NumberFormat = DecimalFormat(DEFAULT_FORMAT_PATTERN),
): String {
only as an extension function in jvmMain?
Hmm. It would be really nice to maintain binary compatibility so we may have to do an expect/actual dance on the enums so as to be able to hang it directly on the types. It certainly sucks for maintaining, but it'll make consumer's lives easier.