1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2025-11-12 01:50:19 +00:00

add js target

This commit is contained in:
2019-12-03 12:40:21 +06:00
parent b582adc3a0
commit 0c1df47dbb
13 changed files with 40 additions and 29 deletions

View File

@@ -0,0 +1,19 @@
package com.github.insanusmokrassar.TelegramBotAPI.utils
import com.benasher44.uuid.uuid4
import kotlinx.io.core.Input
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
@Serializable
actual data class StorageFile(
actual val contentType: String,
actual val fileName: String,
@Transient
val inputGetter: () -> Input = throw IllegalStateException("Can't create object without input"),
@Transient
val extension: String = throw IllegalStateException("Can't create object without extension")
) {
actual fun asInput(): Input = inputGetter()
actual fun generateCustomName(): String = "${uuid4()}.$extension"
}