AsyncFs

expect open class AsyncFs(source)

A contextual reference which provides access to a secondary, asynchronous implementation of the kmp-file:file API. On Jvm/Native, the synchronous kmp-file:file functions are simply called within the provided ctx (such as a background dispatcher). On Js/WasmJs, the kmp-file:file module exposes via InternalFileApi JavaScript's asynchronous callback API which is used in lieu of its synchronous API, which is called within the provided ctx.

See also

Inheritors

actual open class AsyncFs(source)

Inheritors

actual open class AsyncFs(source)

Inheritors

actual open class AsyncFs(source)

Inheritors

Types

Link copied to clipboard
expect object Default : AsyncFs

The default AsyncFs implementation. On Jvm/Native, ctx is Dispatchers.IO. On Js/WasmJs, ctx is Dispatchers.Default.

actual object Default : AsyncFs
actual object Default : AsyncFs
actual object Default : AsyncFs

Properties

Link copied to clipboard
expect val ctx: CoroutineContext

The CoroutineContext for which all asynchronous functionality for this AsyncFs is derived from.

actual val ctx: CoroutineContext
@JvmField
actual val ctx: CoroutineContext
actual val ctx: CoroutineContext

Functions

Link copied to clipboard
suspend fun AsyncFs.absoluteFile2(file: File): File

An asynchronous version of io.matthewnelson.kmp.file.absoluteFile2.

Link copied to clipboard
expect inline suspend fun File.absoluteFile2Async(): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.absoluteFile2Async(): File
actual inline suspend fun File.absoluteFile2Async(): File
actual inline suspend fun File.absoluteFile2Async(): File
Link copied to clipboard
suspend fun AsyncFs.absolutePath2(file: File): String

An asynchronous version of io.matthewnelson.kmp.file.absolutePath2.

Link copied to clipboard
expect inline suspend fun File.absolutePath2Async(): String

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.absolutePath2Async(): String
actual inline suspend fun File.absolutePath2Async(): String
actual inline suspend fun File.absolutePath2Async(): String
Link copied to clipboard
inline suspend fun AsyncFs.append(file: File, excl: OpenExcl?, data: Buffer)

An asynchronous version of io.matthewnelson.kmp.file.append.

inline suspend fun AsyncFs.append(file: File, excl: OpenExcl?, src: ByteBuffer): Int

An asynchronous version of io.matthewnelson.kmp.file.append.

Link copied to clipboard
inline suspend fun File.appendAsync(excl: OpenExcl?, data: Buffer)

Syntactic sugar. To be used with AsyncFs.with.

inline suspend fun File.appendAsync(excl: OpenExcl?, src: ByteBuffer): Int

Syntactic sugar. To be used with AsyncFs.with.

Link copied to clipboard
inline suspend fun AsyncFs.appendBytes(file: File, excl: OpenExcl?, array: ByteArray): File

An asynchronous version of io.matthewnelson.kmp.file.appendBytes.

Link copied to clipboard
expect inline suspend fun File.appendBytesAsync(excl: OpenExcl?, array: ByteArray): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.appendBytesAsync(excl: OpenExcl?, array: ByteArray): File
actual inline suspend fun File.appendBytesAsync(excl: OpenExcl?, array: ByteArray): File
actual inline suspend fun File.appendBytesAsync(excl: OpenExcl?, array: ByteArray): File
Link copied to clipboard
inline suspend fun AsyncFs.appendUtf8(file: File, excl: OpenExcl?, text: String): File

An asynchronous version of io.matthewnelson.kmp.file.appendUtf8.

Link copied to clipboard
expect inline suspend fun File.appendUtf8Async(excl: OpenExcl?, text: String): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.appendUtf8Async(excl: OpenExcl?, text: String): File
actual inline suspend fun File.appendUtf8Async(excl: OpenExcl?, text: String): File
actual inline suspend fun File.appendUtf8Async(excl: OpenExcl?, text: String): File
Link copied to clipboard
suspend fun AsyncFs.canonicalFile2(file: File): File

An asynchronous version of io.matthewnelson.kmp.file.canonicalFile2.

Link copied to clipboard
expect inline suspend fun File.canonicalFile2Async(): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.canonicalFile2Async(): File
actual inline suspend fun File.canonicalFile2Async(): File
actual inline suspend fun File.canonicalFile2Async(): File
Link copied to clipboard
suspend fun AsyncFs.canonicalPath2(file: File): String

An asynchronous version of io.matthewnelson.kmp.file.canonicalPath2.

Link copied to clipboard
expect inline suspend fun File.canonicalPath2Async(): String

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.canonicalPath2Async(): String
actual inline suspend fun File.canonicalPath2Async(): String
actual inline suspend fun File.canonicalPath2Async(): String
Link copied to clipboard
@JvmOverloads
suspend fun AsyncFs.chmod2(file: File, mode: String, mustExist: Boolean = true): File

An asynchronous version of io.matthewnelson.kmp.file.chmod2.

Link copied to clipboard
expect inline suspend fun File.chmod2Async(mode: String, mustExist: Boolean = true): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.chmod2Async(mode: String, mustExist: Boolean): File
actual inline suspend fun File.chmod2Async(mode: String, mustExist: Boolean): File
actual inline suspend fun File.chmod2Async(mode: String, mustExist: Boolean): File
Link copied to clipboard
@JvmOverloads
suspend fun AsyncFs.delete2(file: File, ignoreReadOnly: Boolean = false, mustExist: Boolean = false): File

An asynchronous version of io.matthewnelson.kmp.file.delete2.

Link copied to clipboard
expect inline suspend fun File.delete2Async(ignoreReadOnly: Boolean = false, mustExist: Boolean = false): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.delete2Async(ignoreReadOnly: Boolean, mustExist: Boolean): File
actual inline suspend fun File.delete2Async(ignoreReadOnly: Boolean, mustExist: Boolean): File
actual inline suspend fun File.delete2Async(ignoreReadOnly: Boolean, mustExist: Boolean): File
Link copied to clipboard
suspend fun AsyncFs.exists2(file: File): Boolean

An asynchronous version of io.matthewnelson.kmp.file.exists2.

Link copied to clipboard
expect inline suspend fun File.exists2Async(): Boolean

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.exists2Async(): Boolean
actual inline suspend fun File.exists2Async(): Boolean
actual inline suspend fun File.exists2Async(): Boolean
Link copied to clipboard
suspend fun AsyncFs.lstat(file: File): Stats

An asynchronous version of io.matthewnelson.kmp.file.lstat.

Link copied to clipboard
inline suspend fun File.lstatAsync(): Stats

Syntactic sugar. To be used with AsyncFs.with.

Link copied to clipboard
@JvmOverloads
suspend fun AsyncFs.mkdir2(dir: File, mode: String?, mustCreate: Boolean = false): File

An asynchronous version of io.matthewnelson.kmp.file.mkdir2.

Link copied to clipboard
expect inline suspend fun File.mkdir2Async(mode: String?, mustCreate: Boolean = false): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.mkdir2Async(mode: String?, mustCreate: Boolean): File
actual inline suspend fun File.mkdir2Async(mode: String?, mustCreate: Boolean): File
actual inline suspend fun File.mkdir2Async(mode: String?, mustCreate: Boolean): File
Link copied to clipboard
@JvmOverloads
suspend fun AsyncFs.mkdirs2(dir: File, mode: String?, mustCreate: Boolean = false): File

An asynchronous version of io.matthewnelson.kmp.file.mkdirs2.

Link copied to clipboard
expect inline suspend fun File.mkdirs2Async(mode: String?, mustCreate: Boolean = false): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.mkdirs2Async(mode: String?, mustCreate: Boolean): File
actual inline suspend fun File.mkdirs2Async(mode: String?, mustCreate: Boolean): File
actual inline suspend fun File.mkdirs2Async(mode: String?, mustCreate: Boolean): File
Link copied to clipboard
inline suspend fun AsyncFs.openAppend(file: File, excl: OpenExcl?): FileStream.Write

An asynchronous version of io.matthewnelson.kmp.file.openAppend.

Link copied to clipboard
expect inline suspend fun File.openAppendAsync(excl: OpenExcl?): FileStream.Write

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.openAppendAsync(excl: OpenExcl?): FileStream.Write
actual inline suspend fun File.openAppendAsync(excl: OpenExcl?): FileStream.Write
actual inline suspend fun File.openAppendAsync(excl: OpenExcl?): FileStream.Write
Link copied to clipboard
suspend fun AsyncFs.openRead(file: File): FileStream.Read

An asynchronous version of io.matthewnelson.kmp.file.openRead.

Link copied to clipboard
expect inline suspend fun File.openReadAsync(): FileStream.Read

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.openReadAsync(): FileStream.Read
actual inline suspend fun File.openReadAsync(): FileStream.Read
actual inline suspend fun File.openReadAsync(): FileStream.Read
Link copied to clipboard
Link copied to clipboard
expect inline suspend fun File.openReadWriteAsync(excl: OpenExcl?): FileStream.ReadWrite

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.openReadWriteAsync(excl: OpenExcl?): FileStream.ReadWrite
actual inline suspend fun File.openReadWriteAsync(excl: OpenExcl?): FileStream.ReadWrite
actual inline suspend fun File.openReadWriteAsync(excl: OpenExcl?): FileStream.ReadWrite
Link copied to clipboard
inline suspend fun AsyncFs.openWrite(file: File, excl: OpenExcl?): FileStream.Write
suspend fun AsyncFs.openWrite(file: File, excl: OpenExcl?, appending: Boolean): FileStream.Write

An asynchronous version of io.matthewnelson.kmp.file.openWrite.

Link copied to clipboard
expect inline suspend fun File.openWriteAsync(excl: OpenExcl?): FileStream.Write
expect inline suspend fun File.openWriteAsync(excl: OpenExcl?, appending: Boolean): FileStream.Write

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.openWriteAsync(excl: OpenExcl?): FileStream.Write
actual inline suspend fun File.openWriteAsync(excl: OpenExcl?, appending: Boolean): FileStream.Write
actual inline suspend fun File.openWriteAsync(excl: OpenExcl?): FileStream.Write
actual inline suspend fun File.openWriteAsync(excl: OpenExcl?, appending: Boolean): FileStream.Write
actual inline suspend fun File.openWriteAsync(excl: OpenExcl?): FileStream.Write
actual inline suspend fun File.openWriteAsync(excl: OpenExcl?, appending: Boolean): FileStream.Write
Link copied to clipboard
suspend fun AsyncFs.read(file: File): Buffer

An asynchronous version of io.matthewnelson.kmp.file.read.

suspend fun AsyncFs.read(file: File): ByteBuffer

An asynchronous version of io.matthewnelson.kmp.file.read.

Link copied to clipboard
inline suspend fun File.readAsync(): Buffer

Syntactic sugar. To be used with AsyncFs.with.

inline suspend fun File.readAsync(): ByteBuffer

Syntactic sugar. To be used with AsyncFs.with.

Link copied to clipboard
suspend fun AsyncFs.readBytes(file: File): ByteArray

An asynchronous version of io.matthewnelson.kmp.file.readBytes.

Link copied to clipboard
expect inline suspend fun File.readBytesAsync(): ByteArray

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.readBytesAsync(): ByteArray
actual inline suspend fun File.readBytesAsync(): ByteArray
actual inline suspend fun File.readBytesAsync(): ByteArray
Link copied to clipboard
suspend fun AsyncFs.readUtf8(file: File): String

An asynchronous version of io.matthewnelson.kmp.file.readUtf8.

Link copied to clipboard
expect inline suspend fun File.readUtf8Async(): String

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.readUtf8Async(): String
actual inline suspend fun File.readUtf8Async(): String
actual inline suspend fun File.readUtf8Async(): String
Link copied to clipboard
suspend fun AsyncFs.stat(file: File): Stats

An asynchronous version of io.matthewnelson.kmp.file.stat.

Link copied to clipboard
inline suspend fun File.statAsync(): Stats

Syntactic sugar. To be used with AsyncFs.with.

Link copied to clipboard
inline fun <R> AsyncFs.with(block: AsyncFs.() -> R): R

All AsyncFs function implementations are top-level extension functions. This provides a way for callers to easily switch context where File extension functions can be used, matching the syntax of kmp-file:file's synchronous API.

Link copied to clipboard
inline suspend fun AsyncFs.write(file: File, excl: OpenExcl?, data: Buffer)
suspend fun AsyncFs.write(file: File, excl: OpenExcl?, appending: Boolean, data: Buffer)

An asynchronous version of io.matthewnelson.kmp.file.write.

inline suspend fun AsyncFs.write(file: File, excl: OpenExcl?, src: ByteBuffer): Int
suspend fun AsyncFs.write(file: File, excl: OpenExcl?, appending: Boolean, src: ByteBuffer): Int

An asynchronous version of io.matthewnelson.kmp.file.write.

Link copied to clipboard
inline suspend fun File.writeAsync(excl: OpenExcl?, data: Buffer)
inline suspend fun File.writeAsync(excl: OpenExcl?, appending: Boolean, data: Buffer)

Syntactic sugar. To be used with AsyncFs.with.

inline suspend fun File.writeAsync(excl: OpenExcl?, src: ByteBuffer): Int
inline suspend fun File.writeAsync(excl: OpenExcl?, appending: Boolean, src: ByteBuffer): Int

Syntactic sugar. To be used with AsyncFs.with.

Link copied to clipboard
inline suspend fun AsyncFs.writeBytes(file: File, excl: OpenExcl?, array: ByteArray): File
suspend fun AsyncFs.writeBytes(file: File, excl: OpenExcl?, appending: Boolean, array: ByteArray): File

An asynchronous version of io.matthewnelson.kmp.file.writeBytes.

Link copied to clipboard
expect inline suspend fun File.writeBytesAsync(excl: OpenExcl?, array: ByteArray): File
expect inline suspend fun File.writeBytesAsync(excl: OpenExcl?, appending: Boolean, array: ByteArray): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.writeBytesAsync(excl: OpenExcl?, array: ByteArray): File
actual inline suspend fun File.writeBytesAsync(excl: OpenExcl?, appending: Boolean, array: ByteArray): File
actual inline suspend fun File.writeBytesAsync(excl: OpenExcl?, array: ByteArray): File
actual inline suspend fun File.writeBytesAsync(excl: OpenExcl?, appending: Boolean, array: ByteArray): File
actual inline suspend fun File.writeBytesAsync(excl: OpenExcl?, array: ByteArray): File
actual inline suspend fun File.writeBytesAsync(excl: OpenExcl?, appending: Boolean, array: ByteArray): File
Link copied to clipboard
inline suspend fun AsyncFs.writeUtf8(file: File, excl: OpenExcl?, text: String): File
suspend fun AsyncFs.writeUtf8(file: File, excl: OpenExcl?, appending: Boolean, text: String): File

An asynchronous version of io.matthewnelson.kmp.file.writeUtf8.

Link copied to clipboard
expect inline suspend fun File.writeUtf8Async(excl: OpenExcl?, text: String): File
expect inline suspend fun File.writeUtf8Async(excl: OpenExcl?, appending: Boolean, text: String): File

Syntactic sugar. To be used with AsyncFs.with.

actual inline suspend fun File.writeUtf8Async(excl: OpenExcl?, text: String): File
actual inline suspend fun File.writeUtf8Async(excl: OpenExcl?, appending: Boolean, text: String): File
actual inline suspend fun File.writeUtf8Async(excl: OpenExcl?, text: String): File
actual inline suspend fun File.writeUtf8Async(excl: OpenExcl?, appending: Boolean, text: String): File
actual inline suspend fun File.writeUtf8Async(excl: OpenExcl?, text: String): File
actual inline suspend fun File.writeUtf8Async(excl: OpenExcl?, appending: Boolean, text: String): File