core/features/content/server/src/jvmMain/kotlin/dev/inmo/postssystem/features/content/server/PartDataContentDownloading.kt

23 lines
664 B
Kotlin

package dev.inmo.postssystem.features.content.server
import com.benasher44.uuid.uuid4
import dev.inmo.micro_utils.common.FileName
import io.ktor.http.content.PartData
import java.io.File
suspend fun PartData.loadContent() {
when (this) {
is PartData.FormItem -> TODO()
is PartData.FileItem -> {
val fileName = FileName(originalFileName ?: return null)
val downloadTo = File.createTempFile(
uuid4().toString(),
fileName.extension
)
headers["data"]
return
}
is PartData.BinaryItem -> return null/* Currently impossible state */
}
}