NodeJS bindings moving to n-api. Update nodejs!

(Seph Gentle) #1


Small update about the nodejs bindings. Currently the bindings don’t support node version 12 (which came out a few weeks ago). Rather than patch up the build issues, I’ve ported all of the native code to n-api, which is the new hotness for native node modules. This means one build per OS, portable across every version(*) of nodejs past and future. It should also run a bit faster owing to better threading code, although I haven’t done any benchmarks yet.

However, there’s a catch: n-api isn’t supported on old builds of nodejs. Its been backported to node 8 but only as of node 8.16, which was released less than a month ago. For now I’ve left in the fallback build - older versions of nodejs will still try to compile the older binding code after running an npm install. For that to work you’ll need the FDB headers installed locally, and a working compilation chain (eg apt-get install build-essentials).

Going forward, even that will stop working and you’ll need to update nodejs to:

  • Node 8.16 or newer (released a few weeks ago)
  • Node 10.7 or newer (released mid 2018)
  • Node 11, 12, or anything released in our glorious future

Older versions of nodejs will no longer be supported by the foundationdb bindings. I’m going to remove the old code entirely in a few months because its too much trouble to maintain both versions, and keep their respective APIs in sync with one another and with the JS code.