0.0.2 • Published 5 years ago

flips-wasm v0.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
5 years ago

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