@mega-apps/node-ex
Version:
Mega-Apps node addon.
21 lines (16 loc) • 632 B
JavaScript
const { loadBinding } = require('@node-rs/helper')
/**
* __dirname means load native addon from current dir
* 'node-ex' is the name of native addon
* the second arguments was decided by `napi.name` field in `package.json`
* the third arguments was decided by `name` field in `package.json`
* `loadBinding` helper will load `node-ex.[PLATFORM].node` from `__dirname` first
* If failed to load addon, it will fallback to load from `node-ex-[PLATFORM]`
*/
let nativeModule = {};
try {
nativeModule = loadBinding(__dirname,'node-ex', '@mega-apps/node-ex');
} catch (e) {
console.warn(e);
}
module.exports = nativeModule;