Created
July 26, 2022 01:56
-
-
Save jefisu/0fbc693a11325bf3097ed647ad50b7ac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io.ktor.http.content.* | |
import java.io.File | |
fun PartData.FileItem.save(path: String, fileName: String) { | |
val fileBytes = streamProvider().readBytes() | |
val folder = File(path) | |
folder.mkdir() | |
File("$path$fileName").writeBytes(fileBytes) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment