这是indexloc提供的服务,不要输入任何密码
Skip to content

sosukesuzuki/wat2ta

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wat2ta

A command-line tool to convert WebAssembly Text Format (WAT) files into JavaScript Uint8Array representation.

Prerequisites

Installation

npm install -g wat2ta

Usage

wat2ta <wat-file>

Example:

$ cat example.wat
(module
  (func (export "add") (param i32 i32) (result i32)
    local.get 0
    local.get 1
    i32.add))

$ wat2ta example.wat
const wasmCode = new Uint8Array([0, 97, 115, 109, ...]);

The output can be used directly in JavaScript code to instantiate a WebAssembly module:

const wasmCode = new Uint8Array([...]); // Output from wat2ta
WebAssembly.instantiate(wasmCode).then(obj => {
  // Use the WebAssembly instance
});

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published