npm CLI to download Node.js N-API headers and/or node-addon-api headers (for C++).
This package is available in the Node Package Repository and can be easily installed with npm or yarn.
$ npm install napi-headers -g
# or
$ npx napi-headers
When installed globally the nodehead
(or napihead
) executable will be exposed in your terminal.
$ nodehead -c -o ./include
napi-headers can be used as an API as well.
const headers = require("napi-headers");
headers.napi(process.cwd()).catch(console.error)
Download N-API headers at the given destination. Version must be a valid Node.js release version (take a look here).
Download Node-addon-api headers at the given destination. Version must be a valid node-addon-api package version.
argument | shortcut | description | default value |
---|---|---|---|
--napi | -n | Download Node.js N-API Headers | false |
--cpp | -c | Download node-addon-api Headers | false |
--output | -o | Ouput directory for headers | process.cwd()/include |
When --cpp
is requested, --napi
is ignored because node-addon-api already include Node.js N-API headers.
Note: when output is undefined, the include directory will be created automatically !
If you want to download headers for a specific version of Node.js, just write:
$ nodehead -n v11.0.0
If you want to download a given version of node-addon-api (for headers), just write:
$ nodehead -c 1.6.0
MIT