fixes for kdocs

This commit is contained in:
2021-10-18 22:57:25 +06:00
parent c9237b3f00
commit cda9d09689
5 changed files with 53 additions and 23 deletions

View File

@@ -6,6 +6,9 @@ import org.w3c.files.File
import org.w3c.files.FileReader
import kotlin.js.Promise
/**
* @suppress
*/
actual typealias MPPFile = File
fun MPPFile.readBytesPromise() = Promise<ByteArray> { success, failure ->
@@ -23,10 +26,19 @@ fun MPPFile.readBytesPromise() = Promise<ByteArray> { success, failure ->
private suspend fun MPPFile.dirtyReadBytes(): ByteArray = readBytesPromise().await()
/**
* @suppress
*/
actual val MPPFile.filename: FileName
get() = FileName(name)
/**
* @suppress
*/
actual val MPPFile.filesize: Long
get() = size.toLong()
/**
* @suppress
*/
@Warning("That is not optimized version of bytes allocator. Use asyncBytesAllocator everywhere you can")
actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator
get() = ::dirtyReadBytes

View File

@@ -4,12 +4,24 @@ import dev.inmo.micro_utils.coroutines.doInIO
import dev.inmo.micro_utils.coroutines.doOutsideOfCoroutine
import java.io.File
/**
* @suppress
*/
actual typealias MPPFile = File
/**
* @suppress
*/
actual val MPPFile.filename: FileName
get() = FileName(name)
/**
* @suppress
*/
actual val MPPFile.filesize: Long
get() = length()
/**
* @suppress
*/
actual val MPPFile.bytesAllocator: SuspendByteArrayAllocator
get() = {
doInIO {