Skip to content

MaxAtoms/kotlin-multiplatform-stdin

Repository files navigation

Kotlin Multi-platform Stdin Demo

This is a simple Kotlin/Wasm application that demonstrates how to read from standard input (stdin) and write to standard output (stdout) using the WASI API. As there is no standard library support for reading from stdin in Kotlin/Wasm, this example uses fd_read directly to achieve this functionality.

Start with:

./gradlew wasmWasiWasmtimeProductionRun

You can then type input in the terminal, and the program will echo it back. Stop with CTRL+D.

Alternatively, run the compiled WASM file directly, if wasmtime is installed globally:

wasmtime -W function-references,gc,exceptions ./WasmStdin.wasm

Gradle places the compiled WASM file to:

./build/compileSync/wasmWasi/main/productionExecutable/kotlin/WasmStdin.wasm

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages