Join Slack
Powered by
How can I read command line arguments (not stdin) ...
# webassembly
d
dh44t
12/10/2024, 5:45 PM
How can I read command line arguments (not stdin) on wasmWasi nodejs application? Thanks in advance.
e
ephemient
12/10/2024, 5:52 PM
I just did this a few days ago.
https://github.com/ephemient/aoc2024/blob/main/kt/aoc2024-exe/src/wasmWasiMain/kotlin/com/github/ephemient/aoc2024/exe/WasiArgv.kt
👍 1
d
dh44t
12/10/2024, 5:57 PM
That’s great, I’ll have a look
dh44t
12/14/2024, 2:37 PM
I managed to do it for WasmJS
dh44t
12/14/2024, 2:38 PM
https://github.com/MarioAriasC/monkey.kt/blob/aec7fec5d6f758c4d2ac871c641154c2425179e0/monkey-wasm-js/src/wasmJsMain/kotlin/Main.kt#L6
e
ephemient
12/14/2024, 2:45 PM
yes you can just use the js api in wasmJs, I've done that too.
https://github.com/ephemient/aoc2024/blob/main/kt/aoc2024-exe/src/wasmJsMain/kotlin/com/github/ephemient/aoc2024/exe/WasmJsMain.kt
but that's different from wasmWasi
d
dh44t
12/14/2024, 3:09 PM
I tried your version but I didn’t work on my code, dunno why
dh44t
12/14/2024, 3:09 PM
I have both wasi and js, for wasi I used your version
12
Views
Open in Slack
Previous
Next