Run arbitrary WASM/WASI files

Overview

wasm-run

Run arbitrary WASM/WASI files

NPM version GitHub stars GitHub issues GitHub license

Installation

$ npm install wasm-run -g

Usage

$ wasm-run --help        
wasm-run [options] <file> [--] [args..]

Options:
  -i, --invoke     Function to execute  [string]
  -t, --timeout    Execution timeout (ms)
      --trace      Trace imported function calls  [boolean]
      --gas-limit  Gas limit  [default: 100000]
      --version    Show version number  [boolean]
      --help       Show help  [boolean]

Run a single exported function

$ wasm-run ./test/fib32.wasm 32
[runtime] Running fib(32)...
[runtime] Result: 2178309

WAT file with multivalue support

$ wasm-run --invoke=swap_i64 ./test/swap.wat 10 12
[runtime] Converted to binary (256 bytes)
[runtime] Running swap_i64(10,12)...
[runtime] Result: 12,10

WASI support

$ wasm-run wasi-hello-world.wasm
Hello world!

Imported function tracing

$ wasm-run --trace wasi-hello-world.wasm
[runtime] wasi_snapshot_preview1!fd_prestat_get 3,65528 => 0
[runtime] wasi_snapshot_preview1!fd_prestat_dir_name 3,70064,2 => 0
[runtime] wasi_snapshot_preview1!fd_prestat_get 4,65528 => 0
[runtime] wasi_snapshot_preview1!fd_prestat_dir_name 4,70064,2 => 0
...

Gas metering/limiting

wasm-meter can be installed via npm install wasm-metering -g

$ wasm-meter fib64.wasm fib64.metered.wasm
$ wasm-run fib64.metered.wasm 8
[runtime] Running fib(8)...
[runtime] Result: 21
[runtime] Gas used: 5.1874
$ wasm-run fib64.metered.wasm 30
[runtime] Running fib(30)...
[runtime] Error: Run out of gas (gas used: 100000.0177)

Features

Load wasm and wat files (using Binaryen)
Run specific exported function
Run wasi-snapshot-preview1 apps via --experimental-wasi-unstable-preview1 flag
Run wasi-unstable apps (compatibility layer)
i64 args, multi-value, bulk-memory, tail-calls support via experimental flags
Generic imports tracing
Gas metering/limiting
☐ Compiled wasm caching (blocked by #1)
☐ WASI API and structures decoding (generate from witx?)
☐ REPL mode

You might also like...

🚀AI拟声: 5秒内克隆您的声音并生成任意语音内容 Clone a voice in 5 seconds to generate arbitrary speech in real-time

🚀AI拟声: 5秒内克隆您的声音并生成任意语音内容 Clone a voice in 5 seconds to generate arbitrary speech in real-time

English | 中文 Features 🌍 Chinese supported mandarin and tested with multiple datasets: aidatatang_200zh, magicdata, aishell3, and etc. 🤩 PyTorch work

Dec 29, 2022

Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability.

Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability.

3DPrint-Lite-1.9.1.4-File-Upload Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability. The Vulnerability: This vulnerabil

Mar 15, 2022

A good web interface for youtube-dl that allows you to download arbitrary mixes of audio and video, including up to the highest quality such as 8K.

A good web interface for youtube-dl that allows you to download arbitrary mixes of audio and video, including up to the highest quality such as 8K.

🚀 youtube-dl-web A good web interface for youtube-dl that allows you to download arbitrary mixes of audio and video, including up to the highest qual

Dec 30, 2022

Serialize arbitrary NodeJS closures and customize serialization behavior.

Closure Serializer This is a fork of the Pulumi Closure Serializer. @pulumi/pulumi. Motivation Functionless allows developers to write cloud applicati

Jul 19, 2022

Render arbitrary Markdown content in Astro, optionally integrating with any existing configuration.

Astro Markdown Astro Markdown lets you render arbitrary Markdown content in Astro, optionally integrating with any existing configuration. --- import

Dec 22, 2022

Cloud Run Jobs Demos - A collection of samples to show you how and when to run a container to completion without a server

Cloud Run Jobs Demo Applications Cloud Run Jobs allows you to run a container to completion without a server. This repository contains a collection of

Dec 23, 2022

Run a command, watch the filesystem, stop the process on file change and then run the command again...

hubmon Run a command, watch the filesystem, stop the process on file change and then run the command again... Install You can install this command lin

Jul 30, 2022

Example repo for getting NextJS, Rust via wasm-pack, and web workers all playing nicely together.

Example of integrating WASM & web workers with a Typescript NextJS project. Running yarn yarn dev Open localhost:3000 Layout Rust code is in ./rust, g

Dec 23, 2022

Add WebAssembly ESM integration to Vite and support wasm-pack generated modules

Add WebAssembly ESM integration (aka. Webpack's asyncWebAssembly) to Vite and support wasm-pack generated modules

Dec 26, 2022

Drawing Newton's fractal using pure js, rust-wasm, SIMDs, threads and GPU

Drawing Newton's fractal using pure js, rust-wasm, SIMDs, threads and GPU

Newton's fractal Runtime Newton's fractal renderer. Click to open in your browser Inspired by 3blue1brown's video about Newton's fractal. Drawing

Nov 17, 2022

WASM-based implementation of Cloudflare's HTML Rewriter for use in Deno, browsers, etc.

HTML Rewriter WASM-based implementation of Cloudflare's HTML Rewriter for use in Deno, browsers, etc. It uses lol-html under the hood, the same implem

Dec 6, 2022

A WASM shell parser and formatter with bash support, based on mvdan/sh

sh-syntax A WASM shell parser and formatter with bash support, based on mvdan/sh TOC Usage Install API Changelog License Usage Install # yarn yarn add

Jan 1, 2023

Remix sandbox repo for Rust compiled to WASM and to native N-API modules

Rust - Remix Sandbox Now with both native Rust and WASM versions! If you want to combine the Web Fundamentals & Modern UX of Remix together with the

Dec 30, 2022

Simple Jai to WASM Proof-of-Concept

Simple Jai to WASM Proof-of-Concept Jai does not officially support WebAssembly compilation target. BUT! It allows you to dump LLVM IR via the llvm_op

Dec 14, 2022

base on webrtc datachannel & ffmpeg wasm H265 player

base on webrtc datachannel & ffmpeg wasm H265 player

1 简介 借助于WebAssembly(简称Wasm)技术,实现在浏览器端调用ffmpeg接口完成H.265码流到YUV数据的解码。 总体流程如下: 2 依赖 2.1 WebAssembly (Wasm) 按照官网的定义,WebAssembly (wasm) 是一个可移植、体积小、加载快并且兼容 W

Jan 1, 2023

High-order Virtual Machine (HVM) wrapper on JavaScript, via WASM

HVM on JavaScript HVM is now available as a JavaScript library! Installing npm i --save hvm-js Examples Evaluating a term to normal form import hvm fr

Nov 24, 2022

Building #dotnet code to target WASM in the browser

Building #dotnet code to target WASM in the browser

WASM Running .NET in a Browser This solution shows you can compile .NET to target a WASM app bundle that can be used independently of a dotnet applica

Oct 14, 2022

Run a command when a certain file exists, and/or watch files to rerun on changes

Run a command when a certain file exists, and/or watch files to rerun on changes

Sep 23, 2022
Owner
Wasm3 Labs
Wasm3 Labs
Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability.

3DPrint-Lite-1.9.1.4-File-Upload Analysis of WordPress 3D Print Lite 1.9.1.4 - arbitrary file upload vulnerability. The Vulnerability: This vulnerabil

Jakom 4 Mar 15, 2022
Add WebAssembly ESM integration to Vite and support wasm-pack generated modules

Add WebAssembly ESM integration (aka. Webpack's asyncWebAssembly) to Vite and support wasm-pack generated modules

Menci ❤️ 78 Dec 26, 2022
A user script for the web that allows you to view and edit files in the Godot Web Editor

Godot-Web-File-Manager This is a user script for the web that allows you to view and edit files in the Godot Web Editor. You can even use this to enab

Roujel Williams 4 Jan 31, 2022
All information is taken from archived CSV files from the reformagh.ru website

All information is taken from archived CSV files from the reformagh.ru website

Dmitry Koviazin 2 Feb 8, 2022
Tooling to automate converting .xlsx localisation to in-game compatible .json files for Vampire Survivors

vampire-survivors-localisation This tooling is used to automate converting .xlsx localisation to in-game compatible .json files for the game Vampire S

null 17 Dec 8, 2022
A web client port-scanner written in GO, that supports the WASM/WASI interface for Browser WebAssembly runtime execution.

WebAssembly Port Scanner Written in Go with target WASM/WASI. The WASM main function scans all the open ports in the specified range (see main.go), vi

Avi Lumelsky 74 Dec 27, 2022
A Remix stack setup to run on Deno with support for Rust WASM modules!

Remix + Deno + Rust -> Webassembly - The Air Metal Stack Welcome to the Air Metal Stack for Remix! ?? + ?? This stack is a good choice if you want to

Ben Wishovich 60 Jan 5, 2023
A WASI implementation that uses VS Code's extension host as the implementing API

Project This repo has been populated by an initial template to help get you started. Please make sure to update the content to build a great experienc

Microsoft 93 Dec 24, 2022
Patches the AssemblyScript compiler to utilize WASI imports instead of Web APIs.

WASI shim for AssemblyScript Patches the AssemblyScript compiler to utilize WASI imports instead of Web APIs. Note that this shim also serves a higher

The AssemblyScript Project 37 Dec 23, 2022
An arbitrary size Bit-Vector implementation in JavaScript

BitSet.js BitSet.js is an infinite Bit-Array (aka bit vector, bit string, bit set) implementation in JavaScript. That means that if you invert a bit v

Robert Eisele 207 Dec 9, 2022