2

Surprisingly, wabt depends on fs under the hood, which is obviously not available inside a browser. I'm working on an online compiler which translates source code into WAT, so precompilation on the server side is not possible. Any ideas?

3
  • 1
    The Readme in the project’s repository links to a browser demo of wat2wasm. Commented Oct 18, 2024 at 0:06
  • @jsejcksn I see the web app with the example but can't find the actual source code for it. From what i see in both wabt and wat2wasm packages is that they require fs. So mb they just send wat to server and receive wasm from it. If it is possible to use wabt inside a browser, can You provide a code snippet? Thanks. Commented Oct 18, 2024 at 0:21
  • 1
    ^ "I see the web app with the example but can't find the actual source code for it": The CSS, HTML, and JS for every web application are plain text — you can view the source in your browser's dev tools. (or — for example — in Chromium browsers you can navigate to view-source:https://webassembly.github.io/wabt/demo/wat2wasm/) Commented Oct 18, 2024 at 1:00

1 Answer 1

2

If that helps, the Wasm reference interpreter can readily be build into a plain JS library that can encode and decode the Wasm text format.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.