
Security News
Opengrep Adds Apex Support and New Rule Controls in Latest Updates
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
@webassemblyjs/wasm-parser
Advanced tools
The @webassemblyjs/wasm-parser package is a tool for parsing WebAssembly binaries (.wasm files) into a format that is easier to interact with in JavaScript. It can be used to analyze and manipulate WebAssembly modules without having to execute them.
Parsing WebAssembly binaries
This feature allows you to parse .wasm files into an abstract syntax tree (AST) that represents the structure and content of the WebAssembly module.
const { decode } = require('@webassemblyjs/wasm-parser');
const fs = require('fs');
const wasmBuffer = fs.readFileSync('module.wasm');
const ast = decode(wasmBuffer);
console.log(ast);
The 'wabt' package is a set of tools for WebAssembly, built around the WebAssembly Binary Toolkit. It includes functionality to convert between the binary and text representations of WebAssembly, as well as to validate and execute WebAssembly code. It is more comprehensive than @webassemblyjs/wasm-parser, offering a wider range of tools for working with WebAssembly.
The 'wasmparser' package is another WebAssembly binary parser that provides an API for parsing WebAssembly modules. It is designed for performance and can be used in both Node.js and browser environments. Compared to @webassemblyjs/wasm-parser, it may offer better performance and a different API design that might be preferred in certain use cases.
The 'binaryen' package provides a compiler and toolchain infrastructure for WebAssembly. It includes capabilities for optimizing WebAssembly modules, converting between binary and text formats, and generating WebAssembly code. While @webassemblyjs/wasm-parser focuses on parsing, 'binaryen' offers a broader set of tools for compiling and optimizing WebAssembly code.
WebAssembly binary format parser
yarn add @webassemblyjs/wasm-parser
import { decode } from "@webassemblyjs/wasm-parser";
import { readFileSync } from "fs";
const binary = readFileSync("/path/to/module.wasm");
const decoderOpts = {};
const ast = decode(binary, decoderOpts);
dump
: print dump information while decoding (default false
)ignoreCodeSection
: ignore the code section (default false
)ignoreDataSection
: ignore the data section (default false
)FAQs
WebAssembly binary format parser
The npm package @webassemblyjs/wasm-parser receives a total of 20,672,902 weekly downloads. As such, @webassemblyjs/wasm-parser popularity was classified as popular.
We found that @webassemblyjs/wasm-parser demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The latest Opengrep releases add Apex scanning, precision rule tuning, and performance gains for open source static code analysis.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.