@wasmer/wasm-transformer

It helps to run WebAssembly modules in Browsers that doesn't have Wasm BigInt support

version

version(): string

Exported function that returns a string of the current version of the package.

import { version } from "wasm-transformer";

console.log(version()) // x.x.x

lowerI64Imports

lowerI64Imports(wasmBinaryWithI64Imports: Uint8Array): Promise<Uint8Array>

Exported Function to insert trampoline functions for imports that have i64 params or returns. This is useful for running Wasm modules in browsers that do not support JavaScript BigInt -> Wasm i64 integration. Especially in the case for i64 WASI Imports. Returns or resolves the lowered Wasm binary as a Uint8Array.

import { lowerI64Imports } from "@wasmer/wasm-transformer";

const transformWasmModuleBytes = async () => {
  const myWasmModuleBytes = new Uint8Array([ ... ]);
  const loweredWasmModuleBytes = await lowerI64Imports(myWasmModulesBytes);
};
transformWasmModuleBytes();

Last updated