Elaboration of native software solutions for Node.js (addons)

You will find here an overview, as well as an example and an online demonstration, of a fast and easy way to accelerate Node.js application developments.

Node.js, by design, can have some limitations, notably in terms of performance. To overcome these limitations, the designers of Node.js have implemented the handling of addons, which are native software components.

The native code of these addons runs parallel to Node.js, unlike Javascript which runs in (or, more precisely, is executed by) Node.js. Although interacting with Node.js, the native code is independent of Node.js; therefore, an addon is not subject to the limitations of Node.js.

Like any other Node.js component, an addon is used through a Javascript object retrieved using the usual require(…). The addons facilitate the work of Node.js developers by giving them access, in Javascript, to all the features they need, with optimal performances.

Therefore, conforming to the purpose of Node.js, Javascript will remain the main language of Node.js applications. Only the most demanding parts those applications will have an interest to be developed as addons.

See what an addon is by going to NPM, at (to which the below badge corresponds). You will find there an XML parser and preprocessor that I have developed1), as well as a link to the entire corresponding source code.


Test this addon:

  • on your computer, by installing it the classical way (npm install xppq2)), and then launching npm explore xppq -- node test.js; you will then see the result of the parsing of an XML example file after going through the preprocessor,
  • online, on Runkit; you will find there examples of use of this addon, and you can even test it with your own scripts.

Regarding the sources, you may perhaps be particularly interested by the XPPq.js file, which contains the loading of the addon and its encapsulation to allow its access with Javascript, and the test.js and runkit.js files, which show some examples of use of the addon.

Contact me using this form if you want to give a serious boost to your Node.js developments!
1) Most packages on NPM are not addons.
2) Except under Windows, you will also need a C++ compilation environment.
consulting/njs.txt · Last modified: Sat Nov 18 12:38:51 2017 (18/11/17) by Claude SIMON