Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 550
Paulo Coghi Avatar asked Sep 07 '25 15:09

Paulo Coghi


1 Answers

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

like image 102
Satyan Avatar answered Sep 10 '25 01:09

Satyan