19 lines
589 B
Kotlin
19 lines
589 B
Kotlin
package dev.inmo.postssystem.features.common.common
|
|
|
|
import dev.inmo.micro_utils.common.*
|
|
import io.ktor.utils.io.core.ByteReadPacket
|
|
import io.ktor.utils.io.core.Input
|
|
import kotlinx.serialization.Serializable
|
|
|
|
@Serializable(SimpleInputProviderSerializer::class)
|
|
actual class FileBasedInputProvider internal constructor(
|
|
actual val file: MPPFile
|
|
) : SimpleInputProvider {
|
|
override val contentBytes: Long
|
|
get() = file.filesize
|
|
|
|
override fun invoke(): Input = error("Files inputs must not be used directly")
|
|
}
|
|
|
|
fun MPPFile.inputProvider() = FileBasedInputProvider(this)
|