Comments (2)
Hey @munjalpatel
thanks and great question! I guess we need to improve our docs in that regard.
There are many examples in our wasi_tests
. They include "preopens" of host directories (so that WASI executables can access the host file system). Beware, that file access permissions are likely to be removed or changed in our next major version.
You may also find some hints in our changelog which contains my favourite WASI example :)
# after a `wapm install cowsay`
{:ok, bytes } = File.read("wapm_packages/_/[email protected]/target/wasm32-wasi/release/cowsay.wasm")
{:ok, stdout} = Wasmex.Pipe.create()
{:ok, stdin} = Wasmex.Pipe.create()
{:ok, instance } = Wasmex.start_link(%{bytes: bytes, wasi: %{stdout: stdout, stdin: stdin}})
Wasmex.Pipe.write(stdin, "Why do you never see elephants hiding in trees? Because they're really good at it.")
{:ok, _} = Wasmex.call_function(instance, :_start, [])
IO.puts Wasmex.Pipe.read(stdout)
________________________________________
/ Why do you never see elephants hiding \
| in trees? Because they're really good |
\ at it. /
----------------------------------------
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
:ok
Our official docs may help too. If you find something missing or hard to understand in our docs, I'd be happy for feedback or PRs fixing things :)
Does that help?
from wasmex.
Hey @tessi , thanks a lot, this is very helpful. I was able to understand this reading through the code :)
from wasmex.
Related Issues (20)
- Support rustler 0.22.0-rc1 HOT 1
- Return better errors when a wasm function call traps HOT 1
- Error compilation on Alpine HOT 6
- Interface Types Status ? HOT 5
- Support multiple WebAssembly engines HOT 12
- Switch to Github Actions HOT 2
- Offer precompiled wasmex binaries HOT 3
- Require at least elixir 1.11 HOT 3
- Allow call_function to accept longer GenServer timeouts HOT 1
- Underlying Wasm runtime, wasmer -> wasmtime HOT 17
- Ability to cache compiled modules HOT 2
- How safe is it to run untrusted user wasm modules? HOT 2
- Calls and execution model HOT 10
- Send and receive WASI std IO as Erlang messages HOT 1
- Switch to an async Rust runtime
- Seems like rust is a prerequisite? HOT 1
- Error during default engine config test and fuel consumption test HOT 4
- call_function example does not behave as expected HOT 2
- consume_fuel function example does not work as expected HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wasmex.