8000 GitHub - thlorenz/wasm2js: Compile WebAssembly .wasm files to a commonjs module.
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

thlorenz/wasm2js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wasm2js

Compile WebAssembly .wasm files to a commonjs module.

const wasm2js = require('wasm2js')
const fs = require('fs')

const wasmBuffer = fs.readFileSync('path/to/my.wasm')
const js = wasm2js(wasmBuffer)

CLI

wasm2js example.wasm -o example.js

Installation

npm install wasm2js

wasm2js

Takes a .wasm binary and wraps it inside a commonJS module that can be required in Node.js and the browser.

Parameters

  • wasmBuf Buffer a buffer of the .wasm code

Returns String the commonJS module code that wraps the wasm

Kudos

90% of this code was extracted from @mafintosh's wat2js.

License

MIT

About

Compile WebAssembly .wasm files to a commonjs module.

Resources

License

Stars

Watchers

Forks

Sponsor this project

  •  

Packages

No packages published
0