Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
#!/usr/bin/env node
// @flow
const { parseSource } = require("@webassemblyjs/wast-parser");
const { readFileSync } = require("fs");
const filename = process.argv[2];
if (typeof filename === "undefined") {
throw new Error("Missing file");
}
const content = readFileSync(filename, "utf8");
const ast = parseSource(content);
console.log(JSON.stringify(ast, null, 2));