simpliest version of content upload
This commit is contained in:
@@ -1,14 +1,16 @@
|
||||
package dev.inmo.postssystem.features.common.common
|
||||
|
||||
import dev.inmo.micro_utils.common.MPPFile
|
||||
import dev.inmo.micro_utils.common.bytes
|
||||
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,
|
||||
private val bytes: ByteArray
|
||||
actual val file: MPPFile
|
||||
) : SimpleInputProvider {
|
||||
override fun invoke(): Input = ByteReadPacket(bytes)
|
||||
override fun invoke(): Input = error("Files inputs must not be used directly")
|
||||
}
|
||||
|
||||
fun MPPFile.inputProvider() = FileBasedInputProvider(this)
|
||||
|
Reference in New Issue
Block a user