github.com/bananabytelabs/wazero@v0.0.0-20240105073314-54b22a776da8/cmd/wazero/README.md (about)

     1  ## wazero CLI
     2  
     3  The wazero CLI can be used to execute a standalone WebAssembly binary.
     4  
     5  ### Installation
     6  
     7  ```bash
     8  $ go install github.com/bananabytelabs/wazero/cmd/wazero@latest
     9  ```
    10  
    11  ### Usage
    12  
    13  The wazero CLI accepts a single argument, the path to a WebAssembly binary.
    14  Arguments can be passed to the WebAssembly binary itself after the path.
    15  
    16  ```bash
    17  wazero run calc.wasm 1 + 2
    18  ```
    19  
    20  In addition to arguments, the WebAssembly binary has access to stdout, stderr,
    21  and stdin.
    22  
    23  
    24  ### Docker / Podman
    25  
    26  wazero doesn't currently publish binaries, but you can make your own with our
    27  example [Dockerfile](Dockerfile). It should amount to about 4.5MB total.
    28  
    29  ```bash
    30  # build the image
    31  $ docker build -t wazero:latest -f Dockerfile .
    32  # volume mount wasi or GOOS=js wasm you are interested in, and run it.
    33  $ docker run -v $PWD/testdata/:/wasm wazero:latest /wasm/wasi_arg.wasm 1 2 3
    34  wasi_arg.wasm123
    35  ```