https://github.com/napi-rs/wasm-tools
https://github.com/rustwasm/walrus bindings
https://github.com/napi-rs/wasm-tools
Last synced: 3 months ago
JSON representation
https://github.com/rustwasm/walrus bindings
- Host: GitHub
- URL: https://github.com/napi-rs/wasm-tools
- Owner: napi-rs
- License: mit
- Created: 2024-04-15T03:43:21.000Z (about 2 years ago)
- Default Branch: main
- Last Pushed: 2025-04-15T02:13:33.000Z (about 1 year ago)
- Last Synced: 2025-04-15T03:24:14.340Z (about 1 year ago)
- Language: JavaScript
- Size: 281 KB
- Stars: 10
- Watchers: 4
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# `@napi-rs/wasm-tools`

> https://github.com/rustwasm/walrus bindings
## Install this package
```
pnpm add @napi-rs/wasm-tools -D
yarn add @napi-rs/wasm-tools -D
```
## Usage
```ts
// Generate dwarf info and emit wasm
import { join } from 'node:path'
import { readFile, writeFile } from 'node:fs/promises'
import { fileURLToPath } from 'node:url'
import { ModuleConfig } from '@napi-rs/wasm-tools'
const __dirname = join(fileURLToPath(import.meta.url), '..')
const wasm = await readFile(join(__dirname, 'panic.wasm32-wasi.wasm'))
const binary = new ModuleConfig()
.generateDwarf(true)
.generateNameSection(true)
.generateProducersSection(true)
.preserveCodeTransform(true)
.parse(wasm)
.emitWasm(true)
await writeFile(join(__dirname, 'panic.wasm32-wasi.wasm'), binary)
```