Transforming Modules
Last updated
Was this helpful?
Last updated
Was this helpful?
Note: The final code for this example can be found on .
Irrespective of whether your JavaScript code runs on the client or the server, the statement shown below to will be always needed until browsers land BigInt
support in WebAssembly.
Please repeat the step-by-step instructions given in the example, but with the following changes:
Call your project wasmer-js-transforming-wasi
Download the Wasm module
The coding seen below is very similar to the coding used for the previous Hello World example — but with one very important difference!
Inside function startWasiTask
, we fetch the Wasm file contents and convert it to a Uint8Array
as before, but then there is the additional line:
The call to function lowerI64Imports
performs the all-important transformation that allows a JavaScript BigInt
to be transferred to a WebAssembly i64
.
Now that the interface has been transformed, we can instantiate the WebAssembly module and invoke it as before.
Run the program: