Skip to content

Latest commit

 

History

History
56 lines (39 loc) · 3.21 KB

README.md

File metadata and controls

56 lines (39 loc) · 3.21 KB

SYNOPSIS

NPM Package Build Status Coverage Status

js-standard-style

Injects metering into webassembly binaries

INSTALL

npm install wasm-metering

USAGE

const metering = require('wasm-metering')
const wasm = require('./test.wasm')
const meteredWasm = metering.meterWASM(wasm)

API

meterJSON

./index.js:103-211

Injects metering into a JSON output of wasm2json

Parameters

  • json Object the json tobe metered
  • constTable Object the cost table to meter with. See these notes about the default.
  • costTable (optional, default defaultCostTable)
  • moduleStr [String](default 'metering') the import string for the metering function
  • fieldStr [String](default 'usegas') the field string for the metering function

Returns Object This contains the fields initailAmount, the amount it cost to start the module and module, the metered json.

meterWASM

./index.js:222-229

Injects metering into a webassembly binary

Parameters

  • wasm Object the wasm tobe metered
  • constTable Object the cost table to meter with. See these notes about the default.
  • costTable
  • moduleStr [String](default 'metering') the import string for the metering function
  • fieldStr [String](default 'usegas') the field string for the metering function

Returns Object This contains the fields initailAmount, the amount it cost to start the module and module, the metered json.

LICENSE

MPL-2.0