How to create simple wasmer package (Rust)

Goal

make unixtime parser again like

wasmer run target/wasm32-wasi/release/wasmer_datetime_parser.wasm -- 1690416880

Preparation

curl https://get.wasmer.io -sSfL | sh
rustup target add wasm32-wasi

Edit src/main.rs

parse args with wasi::args_get src/main.rs

Run it locally

cargo build --target wasm32-wasi --release
wasmer run target/wasm32-wasi/release/wasmer_datetime_parser.wasm -- 1690416880
2023-07-27 00:14:40 UTC

Publish as a wasmer package

wasmer init
wasmer login
wasmer publish

Test what published

Go to url and download wasm file then try it

wasmer run [filepath] -- 1690416880
2023-07-27 00:14:40 UTC