flips-wasm
v0.0.2
Published
WebAssembly wrapper for Floating IPS
Downloads
17
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-wasm
Or using Yarn:
yarn add flips-wasm
Usage
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 build
This will create various js
and wasm
files in the lib/
directory.
Acknowledgements
- Alcaro, author of Flips
- Surma, who wrote this useful article