Skip to content

Latest commit

 

History

History
52 lines (35 loc) · 3.04 KB

6-native-api.md

File metadata and controls

52 lines (35 loc) · 3.04 KB

🐢 Node.js

👽 Native API (native addon creation in C and C++)

With Node.js it is also possible to create low level interfaces (addons) to for example execute libraries written in C, C++.

This can bring a performance advantage (but this is not necessarily always the goal... going from C++ to JavaScript has a significant cost). Sometimes it is also simply because the C/C++ libraries are already very complete and maintained (it would be potentially a waste of time to re-implement everything in JavaScript).

Some examples of NPM packages being native addons :

Moreover, to install these packages, you often need to install various dependencies to be able to compile them. I invite you to consult the installation section of Node-gyp if you were not aware of this. (There is also an option to install Node.js on Windows).

If this is a topic that interests you, I myself did a talk in 2019 to popularize and explain my first steps in creating native addons for my SlimIO project.

However, here is a complementary list of resources:

Documentation on GYP tool :

Talks on the native Node.js API :

Bonus:

Rust

Various links to make native addons with Rust rather than C and C++ :


⬅️ 🐢 Node.js: 🎡 Event-loop | ➡️ 🐢 Node.js: 📟 CLI