Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 23, 2024 via pnpm

@webassemblyjs/wasm-edit 1.11.1

> Rewrite a WASM binary
Package summary
Share
0
issues
3
licenses
14
MIT
2
Apache-2.0
1
BSD-3-Clause
Package created
5 Mar 2018
Version published
5 Jul 2021
Maintainers
1
Total deps
17
Direct deps
8
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
14 Packages, Including:
@webassemblyjs/ast@1.11.1
@webassemblyjs/floating-point-hex-parser@1.11.1
@webassemblyjs/helper-api-error@1.11.1
@webassemblyjs/helper-buffer@1.11.1
@webassemblyjs/helper-numbers@1.11.1
@webassemblyjs/helper-wasm-bytecode@1.11.1
@webassemblyjs/helper-wasm-section@1.11.1
@webassemblyjs/ieee754@1.11.1
@webassemblyjs/utf8@1.11.1
@webassemblyjs/wasm-edit@1.11.1
@webassemblyjs/wasm-gen@1.11.1
@webassemblyjs/wasm-opt@1.11.1
@webassemblyjs/wasm-parser@1.11.1
@webassemblyjs/wast-printer@1.11.1

Apache License 2.0

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
use-patent-claims
place-warranty
Cannot
hold-liable
use-trademark
Must
include-copyright
include-license
state-changes
include-notice
2 Packages, Including:
@webassemblyjs/leb128@1.11.1
@xtuc/long@4.2.2

BSD 3-Clause "New" or "Revised" License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
place-warranty
Cannot
use-trademark
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
@xtuc/ieee754@1.2.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

8
All Dependencies CSV
β“˜ This is a list of @webassemblyjs/wasm-edit 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities
@webassemblyjs/ast1.11.135.54 kBMIT
prod
@webassemblyjs/helper-buffer1.11.12.42 kBMIT
prod
@webassemblyjs/helper-wasm-bytecode1.11.14.36 kBMIT
prod
@webassemblyjs/helper-wasm-section1.11.13.82 kBMIT
prod
@webassemblyjs/wasm-gen1.11.14.08 kBMIT
prod
@webassemblyjs/wasm-opt1.11.12.64 kBMIT
prod
@webassemblyjs/wasm-parser1.11.122.69 kBMIT
prod
@webassemblyjs/wast-printer1.11.14.73 kBMIT
prod

Visualizations

Frequently Asked Questions

What does @webassemblyjs/wasm-edit do?

The @webassemblyjs/wasm-edit npm package is a JavaScript utility for rewriting WASM binaries. It allows you to perform operations such as replace, update, insert, and remove an Abstract Syntax Tree (AST) node within the binary in-place.

How do you use @webassemblyjs/wasm-edit?

To use @webassemblyjs/wasm-edit, you first need to install it in your project using the following command:

yarn add @webassemblyjs/wasm-edit

Post installation, you import the required function (edit or add) from the package and pass in the appropriate parameters.

Example code usage to Update:

import { edit } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/]; // WASM binary data

const visitors = {
  ModuleImport({ node }) {
    node.module = "foo";
    node.name = "bar";
  }
};

const newBinary = edit(binary, visitors);

Example code usage to Replace:

import { edit } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/]; // WASM binary data

const visitors = {
  Instr(path) {
    const newNode = t.callInstruction(t.indexLiteral(0));
    path.replaceWith(newNode);
  }
};

const newBinary = edit(binary, visitors);

Example code usage to Remove:

import { edit } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/]; // WASM binary data

const visitors = {
  ModuleExport({ node }) {
    path.remove()
  }
};

const newBinary = edit(binary, visitors);

Example code usage to Insert:

import { add } from "@webassemblyjs/wasm-edit";

const binary = [/*...*/]; // WASM binary data

const newBinary = add(actualBinary, [
  t.moduleImport("env", "mem", t.memory(t.limit(1)))
]);

Where are the @webassemblyjs/wasm-edit docs?

For detailed documentation on using @webassemblyjs/wasm-edit, you can refer to the README file in the webassemblyjs GitHub repository.