Package-level declarations

Types

Link copied to clipboard
expect open class AsyncFs

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.

actual open class AsyncFs
actual open class AsyncFs
actual open class AsyncFs

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
suspend fun AsyncFs.absolutePath2(file: File): String

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

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 AsyncFs.appendBytes(file: File, excl: OpenExcl?, array: ByteArray): File

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

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
suspend fun AsyncFs.canonicalFile2(file: File): File

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

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

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

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
suspend fun FileStream.closeAsync()

An asynchronous version of FileStream.close. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead. Additionally, this function uses the NonCancellable job for withContext to ensure closure is always had.

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
suspend fun AsyncFs.exists2(file: File): Boolean

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

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

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

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
@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
inline suspend fun AsyncFs.openAppend(file: File, excl: OpenExcl?): FileStream.Write

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

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
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
suspend fun FileStream.positionAsync(): Long
suspend fun <S : FileStream> S.positionAsync(new: Long): S

An asynchronous version of FileStream.position. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

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 FileStream.Read.readAsync(buf: ByteArray): Int
inline suspend fun FileStream.Read.readAsync(buf: ByteArray, position: Long): Int
suspend fun FileStream.Read.readAsync(buf: ByteArray, offset: Int, len: Int): Int
suspend fun FileStream.Read.readAsync(buf: ByteArray, offset: Int, len: Int, position: Long): Int

An asynchronous version of FileStream.Read.read. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

inline suspend fun FileStream.Read.readAsync(buf: Buffer): Long
inline suspend fun FileStream.Read.readAsync(buf: Buffer, position: Long): Long
suspend fun FileStream.Read.readAsync(buf: Buffer, offset: Long, len: Long): Long
suspend fun FileStream.Read.readAsync(buf: Buffer, offset: Long, len: Long, position: Long): Long

An asynchronous version of FileStream.Read.read. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

suspend fun FileStream.Read.readAsync(dst: ByteBuffer?): Int
suspend fun FileStream.Read.readAsync(dst: ByteBuffer?, position: Long): Int

An asynchronous version of FileStream.Read.read. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

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

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

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

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

Link copied to clipboard
suspend fun FileStream.sizeAsync(): Long

An asynchronous version of FileStream.size. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

suspend fun <S : FileStream.Write> S.sizeAsync(new: Long): S

An asynchronous version of FileStream.Write.size. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

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

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

Link copied to clipboard
suspend fun <S : FileStream> S.syncAsync(meta: Boolean): S

An asynchronous version of FileStream.sync. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

Link copied to clipboard
inline suspend fun <S : FileStream?, R> S.useAsync(block: (S) -> R): R

An asynchronous version of io.matthewnelson.kmp.file.use whereby closeAsync is called in lieu of FileStream.close.

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 FileStream.Write.writeAsync(buf: ByteArray)
inline suspend fun FileStream.Write.writeAsync(buf: ByteArray, position: Long)
suspend fun FileStream.Write.writeAsync(buf: ByteArray, offset: Int, len: Int)
suspend fun FileStream.Write.writeAsync(buf: ByteArray, offset: Int, len: Int, position: Long)

An asynchronous version of FileStream.Write.write. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

inline suspend fun FileStream.Write.writeAsync(buf: Buffer)
inline suspend fun FileStream.Write.writeAsync(buf: Buffer, position: Long)
suspend fun FileStream.Write.writeAsync(buf: Buffer, offset: Long, len: Long)
suspend fun FileStream.Write.writeAsync(buf: Buffer, offset: Long, len: Long, position: Long)

An asynchronous version of FileStream.Write.write. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

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
suspend fun FileStream.Write.writesAsync(src: ByteBuffer?): Int
suspend fun FileStream.Write.writesAsync(src: ByteBuffer?, position: Long): Int

An asynchronous version of FileStream.Write.write. If FileStream was not opened using AsyncFs, thus not inheriting its CoroutineContext, then the default AsyncFs.ctx will be used instead.

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.