Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Generated on Apr 29, 2024 via pnpm

@webassemblyjs/wasm-edit 1.8.5

> Rewrite a WASM binary
Package summary
Share
5
issues
5
moderate severity
meta
5
4
licenses
18
MIT
1
ISC
1
BSD-3-Clause
1
Apache-2.0
Package created
5 Mar 2018
Version published
24 Feb 2019
Maintainers
1
Total deps
21
Direct deps
8
License
MIT

Issues

5

5 moderate severity issues

moderate
via: @webassemblyjs/ast@1.8.5 & others
via: @webassemblyjs/ast@1.8.5 & others
via: @webassemblyjs/helper-wasm-section@1.8.5 & others
via: @webassemblyjs/helper-wasm-section@1.8.5 & others
via: @webassemblyjs/ast@1.8.5 & others
Collapse
Expand

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
18 Packages, Including:
@webassemblyjs/ast@1.8.5
@webassemblyjs/floating-point-hex-parser@1.8.5
@webassemblyjs/helper-api-error@1.8.5
@webassemblyjs/helper-buffer@1.8.5
@webassemblyjs/helper-code-frame@1.8.5
@webassemblyjs/helper-module-context@1.8.5
@webassemblyjs/helper-wasm-bytecode@1.8.5
@webassemblyjs/helper-wasm-section@1.8.5
@webassemblyjs/ieee754@1.8.5
@webassemblyjs/leb128@1.8.5
@webassemblyjs/utf8@1.8.5
@webassemblyjs/wasm-edit@1.8.5
@webassemblyjs/wasm-gen@1.8.5
@webassemblyjs/wasm-opt@1.8.5
@webassemblyjs/wasm-parser@1.8.5
@webassemblyjs/wast-parser@1.8.5
@webassemblyjs/wast-printer@1.8.5
mamacro@0.0.3

ISC License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
@webassemblyjs/helper-fsm@1.8.5

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

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
1 Packages, Including:
@xtuc/long@4.2.2
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.8.562.32 kBMIT
prod
3
@webassemblyjs/helper-buffer1.8.52.42 kBMIT
prod
@webassemblyjs/helper-wasm-bytecode1.8.58.01 kBMIT
prod
@webassemblyjs/helper-wasm-section1.8.58.17 kBMIT
prod
5
@webassemblyjs/wasm-gen1.8.58.75 kBMIT
prod
5
@webassemblyjs/wasm-opt1.8.55.69 kBMIT
prod
5
@webassemblyjs/wasm-parser1.8.545.18 kBMIT
prod
5
@webassemblyjs/wast-printer1.8.59.88 kBMIT
prod
3

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.