mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-29 13:38:45 +00:00
parent
52157ee0e7
commit
d164813bb4
@ -11,7 +11,6 @@ kotlin {
|
|||||||
commonMain {
|
commonMain {
|
||||||
dependencies {
|
dependencies {
|
||||||
api libs.klock
|
api libs.klock
|
||||||
api libs.kt.io
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
jvmMain {
|
||||||
|
@ -1,11 +1,5 @@
|
|||||||
package dev.inmo.micro_utils.common
|
package dev.inmo.micro_utils.common
|
||||||
|
|
||||||
import kotlinx.io.Buffer
|
|
||||||
import kotlinx.io.Source
|
|
||||||
import kotlinx.io.buffered
|
|
||||||
import kotlinx.io.files.Path
|
|
||||||
import kotlinx.io.files.SystemFileSystem
|
|
||||||
import kotlinx.io.readByteArray
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
import kotlin.jvm.JvmInline
|
import kotlin.jvm.JvmInline
|
||||||
|
|
||||||
@ -29,31 +23,12 @@ value class FileName(val string: String) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
typealias MPPFile = Path
|
expect class MPPFile
|
||||||
|
|
||||||
val MPPFile.filename: FileName
|
expect val MPPFile.filename: FileName
|
||||||
get() = FileName(name)
|
expect val MPPFile.filesize: Long
|
||||||
val MPPFile.filesize: Long
|
expect val MPPFile.bytesAllocatorSync: ByteArrayAllocator
|
||||||
get() = SystemFileSystem.metadataOrNull(this) ?.size ?.takeIf { it > -1 } ?: error("Path $filename does not exists or is folder")
|
expect val MPPFile.bytesAllocator: SuspendByteArrayAllocator
|
||||||
val MPPFile.bytesAllocatorSync: ByteArrayAllocator
|
|
||||||
get() = {
|
|
||||||
source().readByteArray()
|
|
||||||
}
|
|
||||||
val MPPFile.bytesAllocator: SuspendByteArrayAllocator
|
|
||||||
get() = {
|
|
||||||
bytesAllocatorSync()
|
|
||||||
}
|
|
||||||
fun MPPFile.bytesSync() = bytesAllocatorSync()
|
fun MPPFile.bytesSync() = bytesAllocatorSync()
|
||||||
suspend fun MPPFile.bytes() = bytesAllocator()
|
suspend fun MPPFile.bytes() = bytesAllocator()
|
||||||
|
|
||||||
fun MPPFile.source(): Source = SystemFileSystem.source(this).buffered()
|
|
||||||
|
|
||||||
|
|
||||||
//expect class MPPFile
|
|
||||||
//
|
|
||||||
//expect val MPPFile.filename: FileName
|
|
||||||
//expect val MPPFile.filesize: Long
|
|
||||||
//expect val MPPFile.bytesAllocatorSync: ByteArrayAllocator
|
|
||||||
//expect val MPPFile.bytesAllocator: SuspendByteArrayAllocator
|
|
||||||
//fun MPPFile.bytesSync() = bytesAllocatorSync()
|
|
||||||
//suspend fun MPPFile.bytes() = bytesAllocator()
|
|
||||||
|
@ -4,8 +4,6 @@ kt = "1.9.23"
|
|||||||
kt-serialization = "1.6.3"
|
kt-serialization = "1.6.3"
|
||||||
kt-coroutines = "1.8.1"
|
kt-coroutines = "1.8.1"
|
||||||
|
|
||||||
kt-io = "0.5.1"
|
|
||||||
|
|
||||||
kslog = "1.3.4"
|
kslog = "1.3.4"
|
||||||
|
|
||||||
jb-compose = "1.6.2"
|
jb-compose = "1.6.2"
|
||||||
@ -55,7 +53,6 @@ kt-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", vers
|
|||||||
kt-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kt-coroutines" }
|
kt-coroutines-android = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-android", version.ref = "kt-coroutines" }
|
||||||
kt-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kt-coroutines" }
|
kt-coroutines-test = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-test", version.ref = "kt-coroutines" }
|
||||||
|
|
||||||
kt-io = { module = "org.jetbrains.kotlinx:kotlinx-io-core", version.ref = "kt-io" }
|
|
||||||
|
|
||||||
ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" }
|
ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" }
|
||||||
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
|
ktor-serialization-kotlinx-json = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
|
||||||
|
Loading…
Reference in New Issue
Block a user