jsCommon.io.nacular.doodle.datatransport.SimpleFile.kt Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of browser Show documentation
Show all versions of browser Show documentation
A pure Kotlin, UI framework for the Web and Desktop
package io.nacular.doodle.datatransport
import io.nacular.doodle.dom.ArrayBuffer
import io.nacular.doodle.dom.File
import io.nacular.doodle.dom.FileReader
import io.nacular.doodle.dom.Uint8Array
import io.nacular.doodle.dom.get
import io.nacular.doodle.dom.toDouble
import io.nacular.measured.units.BinarySize
import io.nacular.measured.units.BinarySize.Companion.bytes
import io.nacular.measured.units.Measure
import io.nacular.measured.units.Time
import io.nacular.measured.units.Time.Companion.milliseconds
import io.nacular.measured.units.times
import kotlin.coroutines.cancellation.CancellationException
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
/**
* Created by Nicholas Eddy on 12/28/21.
*/
internal actual class SimpleFile actual constructor(private val delegate: File): LocalFile {
override val name : String get() = delegate.name
override val size : Measure get() = delegate.size.toDouble() * bytes
override val type : String get() = delegate.type
override val isClosed : Boolean get() = delegate.isClosed
override val lastModified: Measure