All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jvmMain.dev.inmo.micro_utils.common.CreateTempFileFromInput.kt Maven / Gradle / Ivy

package dev.inmo.micro_utils.common

import java.io.File
import java.io.InputStream
import java.util.UUID

fun InputStream.downloadToTempFile(
    fileName: String = UUID.randomUUID().toString(),
    fileExtension: String? = ".temp",
    folder: File? = null
) = File.createTempFile(
    fileName,
    fileExtension,
    folder
).apply {
    outputStream().use {
        copyTo(it)
    }
    deleteOnExit()
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy