{"id":19752371,"url":"https://github.com/subhra264/wasmrunner","last_synced_at":"2026-06-16T07:31:08.152Z","repository":{"id":118912528,"uuid":"603755030","full_name":"Subhra264/WasmRunner","owner":"Subhra264","description":"CLI tool to execute WebAssembly files","archived":false,"fork":false,"pushed_at":"2023-02-22T13:41:41.000Z","size":1080,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-28T08:44:19.504Z","etag":null,"topics":["cli","cmake","cpp11","wasmedge","webassembly"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Subhra264.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-02-19T13:39:31.000Z","updated_at":"2023-09-14T03:55:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"9fe56553-9d66-4b9b-b568-fb594f508433","html_url":"https://github.com/Subhra264/WasmRunner","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/Subhra264/WasmRunner","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhra264%2FWasmRunner","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhra264%2FWasmRunner/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhra264%2FWasmRunner/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhra264%2FWasmRunner/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Subhra264","download_url":"https://codeload.github.com/Subhra264/WasmRunner/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Subhra264%2FWasmRunner/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34394370,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-16T02:00:06.860Z","response_time":126,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cli","cmake","cpp11","wasmedge","webassembly"],"created_at":"2024-11-12T02:48:58.044Z","updated_at":"2026-06-16T07:31:08.129Z","avatar_url":"https://github.com/Subhra264.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# WasmRunner\n\nA command line tool to execute WebAssembly files.\n\n```bash\n./WasmRunner [version] [-h | --help] [--reactor] [run]\n             [path_to_wasm_file] [entry_function] [args]\n```\n\n## Building\nAs this tool uses `wasmedge` C library as a dependency, it needs to be installed first. Refer to [this](https://wasmedge.org/book/en/quick_start/install.html) as a guide\n\nYou can install it with `git` and `curl` -\n```bash\ncurl -sSf https://raw.githubusercontent.com/WasmEdge/WasmEdge/master/utils/install.sh | bash\n```\n\nAfter you install it, clone this repo -\n```bash\ngit clone https://github.com/Subhra264/WasmRunner.git\n```\n\nMove to the `/WasmRunner` directory -\n```bash\ncd WasmRunner/\n```\n\nNow simply execute the `build.sh` file -\n```bash\n./build.sh\n```\n\nOnce the `build` directory is created, move to the directory and use the tool -\n```bash\ncd build\n\n./WasmRunner version\n```\n\n## How is this built?\n\nThis tool is completely based on the `wasmedge` C library SDK and is written in C++11. There are two files in the `/src` directory -\n- `main.cc` - Responsible for executing all the CLI related logic i.e. taking inputs, doing initial parsing and validation of inputs and printing results or errors to the console.\n- `WasmRunner.cc` - Implements the `WasmRunner` class that wraps the internally used `wasmedge` C library SDK. It exposes various methods necessary for executing a given wasm file.\n\n## WasmRunner class\n\nPublic member functions -\n\n### Constructor\nInstantiates the `WasmRunner` class. Also initializes internally used `WasmEdge_ConfigureContext` and `WasmEdge_VMContext`\n\n#### Params\n- `SuccessHandler` - A success handler function to be called with returned values from the execution of given wasm file\n- `ErrorHandler` - A error handler function to be called with the error message occured during the execution of given wasm file.\n\n#### Returns\n- `WasmRunner` - A new `WasmRunner` instance.\n\n### static GetVersion()\nA `static` member function that returns the `wasmedge` C library version as an array of `char`s.\n\n#### Returns\n- `const char *` -  The version of `wasmedge` C SDK.\n\n### LoadWasmFile()\nLoads the wasm file given using `WasmEdge_VMLoadWasmFromFile` C function.\n\n#### Params\n- `std::string file_name` - The wasm file path to load.\n\n#### Returns\n- `bool` - If true, the operation was successful, failed otherwise.\n\n### ValidateVM()\nInternally uses `WasmEdge_VMValidate` C function to validate the `VM` after loading wasm file.\n\n#### Returns\n- `bool` - If true, the operation was successful, failed otherwise.\n\n### InstantiateVM()\nInternally uses `WasmEdge_VMInstantiate` C function to instantiate the validated wasm module in the `VM` context.\n\n#### Returns\n- `bool` - If true, the operation was successful, failed otherwise.\n\n### RunWasm()\nExecutes the given wasm file.\n\n#### Params\n- `std::vector\u003cstd::string\u003e\u003e params` - A vector with all the wasm file arguments.\n- `bool reactor_enabled` - A boolean representing if reactor flag is on.\n- `std::string entry_func` - If reactor flag is on, a valid entry function name must be given\n\n#### Returns\n- `int` - If `0`, the operation was successful and not successful otherwise.\n\n## Commands\nFollowing are various commands to use with this tool.\n\n### Version\nPrints the version of the underlying `wasmedge` library. All other commands and options are ignored when this command is run.\n\n```bash\n./WasmRunner version\n```\n![WasmRunner version](/assets/wasm_edge_version.png)\n![WasmRunner version ignores all other options](/assets/wasm_runner_version_ignore_others.png)\n\n### Help\nPrints the manual page in the console. When specified all the other options are ignored.\n\n```bash\n./WasmRunner -h\n\n./WasmRunner --help\n```\n\n![WasmRunner help](/assets/wasm_runner_help.png)\n\n### Run\nOptional `run` command followed by a `file path` to a WebAssembly file.\n\n```bash\n./WasmRunner run \u003cfile_path\u003e [args]\n```\n\n![WasmRunner run](/assets/wasm_runner_run.png)\n\n### Without run\nYou can also execute WebAssembly files without the run command. In this case the command will be -\n\n```bash\n./WasmRunner [--reactor] \u003cfile_path\u003e [entry_function_name] [args]\n```\n\n![WasmRunner without run](/assets/wasm_runner_without_run.png)\n\n### Reactor flag\n\nWhen there are multiple funcitons exported by the given WebAssembly file, you can specify a entry function name to be executed. When using this flag, `entry_function_name` after `file_path` is required.\n\n```bash\n./WasmRunner --reactor \u003cfile_path\u003e entry_function_name [args]\n```\n\n![WasmRunner with reactor flag](/assets/wasm_runner_with_reactor.png)\n\n### Errors\n\nWhen something errorneous occurs, the tool fails with `int` code `1` (indicating error) and prints the error message to the CLI console. Here are few of those errors that may occur while running this tool -\n\n#### Too few arguments\nUser passes smaller number of parameters than what actually is required by the exported WebAssembly function.\n\n![WasmRunner too few arguments error](/assets/wasm_runner_too_few_arguments_error.png)\n\n#### Entry function not found\nWhen using with `--reactor` flag, if wrong entry function name (not actually exported) is given, this error message is printed on the console.\n\n![WasmRunner entry function not found](/assets/wasm_runner_entry_func_not_found.png)\n\n![WasmRunner entry function wrongly given](/assets/wasm_runner_entry_func_not_found_wrong_name.png)\n\n#### Entry function not given\nWhen using with `--reactor` flag, if the user does not provide the entry function name at all after the `file_path`, this error message is printed.\n\n![WasmRunner entry function not given](/assets/wasm_runner_entry_func_name_must_be_given.png)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubhra264%2Fwasmrunner","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsubhra264%2Fwasmrunner","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsubhra264%2Fwasmrunner/lists"}