18 lines
536 B
Kotlin
18 lines
536 B
Kotlin
package dev.inmo.postssystem.features.common.common
|
|
|
|
import dev.inmo.micro_utils.common.MPPFile
|
|
import dev.inmo.micro_utils.common.filesize
|
|
import io.ktor.utils.io.core.Input
|
|
import io.ktor.utils.io.streams.asInput
|
|
import kotlinx.serialization.Serializable
|
|
|
|
@Serializable(SimpleInputProviderSerializer::class)
|
|
actual class FileBasedInputProvider(
|
|
actual val file: MPPFile
|
|
) : SimpleInputProvider {
|
|
override val contentBytes: Long?
|
|
get() = file.filesize
|
|
|
|
override fun invoke(): Input = file.inputStream().asInput()
|
|
}
|