NodeJS, difference between N-API, nan, node-gyp and cmake-js

1.1k views Asked by At

I am trying to learn how to use C and/or C++ libraries inside NodeJS.

But it is somewhat confusing the many different tools and approaches, and the relation between them.

What is the difference between NodeJS N-API and "nan", and what is the role played by node-gyp and/or cmake-js.

1

There are 1 answers

2
Satyan On BEST ANSWER

If you are starting a fresh development that involve building native module, then N-API could be an excellent choice. The N-API is the node.js core C API to interact with underlying JavaScript engine (it is relatively a new addition). It provides Application Binary Interface (ABI) stability guarantee across node.js versions.

While I was learning the N-API, a GitHub repository has been created with short note and example. Hope this may help you to get understanding the evolution history and a jump start for creating C/C++ native modules. https://github.com/msatyan/MyNodeC