flips-wasm
v0.0.2
Published
WebAssembly wrapper for Floating IPS
Maintainers
Readme
Floating IPS in Wasm
This is a WebAssembly version of Alcaro's excellent Floating IPS created with Emscripten for use in JavaScript projects.
Installation
npm install flips-wasmOr using Yarn:
yarn add flips-wasmUsage
In Node.js:
const {
bpsCreate,
bpsApply,
ipsCreate,
ipsApply,
upsCreate,
upsApply,
} = require('flips-wasm');In ES6:
import {
bpsCreate,
bpsApply,
ipsCreate,
ipsApply,
upsCreate,
upsApply,
} from 'flips-wasm';The Wasm modules are loaded asynchronously, so you may want to use the corresponding Promise
versions of the functions in your code. The Promise resolves with the result of the Flips function.
import { bpsCreatePromise } from 'flips-wasm';
bpsCreatePromise(sourceFile, targetFile).then(patchFile => {
// ...write to file
});Building
You probably don't need to build this, but I'll tell you how to anyway.
First, make sure you have Emscripten installed so you can use the emcc command.
npm run buildThis will create various js and wasm files in the lib/ directory.
Acknowledgements
- Alcaro, author of Flips
- Surma, who wrote this useful article
