@webassemblyjs/wasm-edit
Rewrite a WASM binary
Replace in-place an AST node in the binary.
Installation
yarn add @webassemblyjs/wasm-editUsage
Update:
import { edit } from "@webassemblyjs/wasm-edit";
const binary = [/*...*/];
const visitors = {
ModuleImport({ node }) {
node.module = "foo";
node.name = "bar";
}
};
const newBinary = edit(binary, visitors);Replace:
Remove:
Insert:
Providing the AST
Providing an AST allows you to handle the decoding yourself, here is the API:
Note that the AST will be updated in-place.
Last updated
Was this helpful?