jsMain.org.jetbrains.base64.Base64.kt Maven / Gradle / Ivy
The newest version!
/* IPRD Group 2022 */
package org.jetbrains.base64
import kotlinx.browser.window
actual object Base64Factory {
actual fun createEncoder(): Base64Encoder = JsBase64Encoder
}
object JsBase64Encoder : Base64Encoder {
override fun encode(src: ByteArray): ByteArray {
val string = src.decodeToString()
val encodedString = window.btoa(string)
return encodedString.encodeToByteArray()
}
}