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

commonMain.raven.Base64Resource.kt Maven / Gradle / Ivy

package raven

import koncurrent.Later
import kotlin.io.encoding.Base64
import kotlin.io.encoding.ExperimentalEncodingApi

class Base64Resource(
    override val name: String,
    override val type: String,
    override val id: String = name,
    private val content: () -> String
) : EmbeddedResource {

    @OptIn(ExperimentalEncodingApi::class)
    override fun read() = Later(Base64.decode(content()))

    fun copy(
        name: String = this.name,
        id: String = this.id
    ) = Base64Resource(name, type, id, content)
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy