An example of a Node.js native addon using C.
No extra tools other than node and a C compiler on $PATH
needed for
build. node-gyp
that ships with node (via npm that ships with node) is used to install node
headers.
If you are on windows, you can write a build.bat
based off of
the Makefile
yourself.
To build and run the addon —
npm run build && npm test
# Should print Hello from addon!
# No npm install necessary either btw.
And as always with JS, there's noise to ask kindly to stfu.
If npm
is yelling about updates, run npm config set update-notifier false
to shut it up.
.node
extension is necessary fornode
to actually load the addon