COM interop layer for Node.JS
npm install cominterop
npm install cominterop
`
Only compatible with Windows (which goes to most typelibs too anyway).
Usage
`
let cominterop = require( 'cominterop' );
let lib = cominterop.load( 'path/to/typelib.dll' );
// Normal constructors.
let obj = new lib.MyClass();
// propget/propput methods mapped to JavaScript getters/setters.
let value = obj.Value;
// Objects have a hidden .Async property which exposes a promise interface.
obj.Async.GetItem()
.then( item => {
console.log( item.Value );
} );
`
Caveats
- Pointer return values won't work maintain identity: obj.Member !== obj.Member,
when Member is non-primitive.
- Support for several data types missing. SAFE_ARRAY the biggest one.
- Only getters supported for indexed properties: arr[ 0 ].
- Uses IDispatch for method invocation.
- My current test libraries are limited to M-Files API.
Other libraries may be completely incompatible without me knowing about it.
Future plans
- Track pointers and return same references for equal pointer values.
- Add compatibility option to load()` for mangling the member names for lower