Streaming Suspend Input Output library for Kotlin Multiplatform.
This is an async IO extension for kotlinx.io based on the async API proposal.
- Supports all Kotlin Multiplatform targets
AsyncReadOnlyFileSysteminterfaceAsyncFileSysteminterfaceAsyncCloseableinterfaceAsyncRawSourceinterfaceAsyncRawSinkinterfaceAsyncSourcewrapper for buffering raw async sourcesAwaitPredicateinterface for await conditions likeexhaustedandavailableDiscardingAsyncSinkobject for voiding dataRandomAsyncSourceobject for sourcing an endless pseudo-random byte streamAsyncSystemFileSystemglobal file system instance via thessio-coremoduleAsyncVirtualFileSystemclass via thessio-vfsmoduleAsyncNoopFileSystemobject via thessio-noopmodule
The following matrix illustrates what implementations are used for which target & runtime combination
in the ssio-core implementation:
| Target | Runtime | Implementation |
|---|---|---|
| JVM | JVM | NIO |
| Android | ART | NIO |
| Linux | Kotlin/Native | CIO/io_uring* |
| Windows | Kotlin/Native | CIO |
| macOS | Kotlin/Native | CIO |
| iOS | Kotlin/Native | CIO |
| tvOS | Kotlin/Native | CIO |
| watchOS | Kotlin/Native | CIO |
| JS | Browser | OPFS |
| JS | NodeJS | fs.promises |
| WASM | Browser | OPFS |
| WASM | NodeJS | fs.promises |
NOTE: Implementations marked with an asterisk* are used only when the underlying system supports them.
The answer is simple: you shouldn't if you don't need a suspend IO API available in your common source set.
If you do, this library is probably what you're looking for.
First, add the official Maven Central repository to your settings.gradle.kts:
dependencyResolutionManagement {
repositories {
mavenCentral()
}
}Then add a dependency on the library in your root buildscript:
kotlin {
sourceSets {
commonMain {
dependencies {
implementation("dev.karmakrafts.ssio:ssio-core:<version>")
}
}
}
}Or, if you are only using Kotlin/JVM, add it to your top-level dependencies block instead.
In order to build SSIO, simply clone this project and run the publishToMavenLocal task:
./gradlew publishToMavenLocalOr on Windows:
gradlew publishToMavenLocalSince the library is built against liburing on Linux, you need to have Linux headers available
under /usr/src/linux-headers. If you need to install them, you can use the provided install_linux_headers.sh
script from the root of the repository.
This assumes a Debian based system and requires the following dependencies to be installed:
build-essential make automake autoconf pkg-config pkgconf libtool gcc bison flex
Official build support for other distributions may be requested.