COM interop layer for Node.JS

COM, interop, typelib
npm install cominterop@0.1.1


Node.js COM interop

Creates runtime proxy classes for a type library.


npm install cominterop

Only compatible with Windows (which goes to most typelibs too anyway).


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.
    .then( item => {
        console.log( item.Value );
    } );


  • 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 case. The upper case method names will confuse linters that expect these to be constructors.


Preprocessing the type library should help a bit with the major performance issues of going with raw IDispatch.

However there are still a lot of dynamic lookups happening - especially in parameter resolution. And the method invocations are done over IDispatch (with all the VARIANTing) instead of using direct COM vtables and other internals.