fraxken / napi-headers

npm CLI to download Node.js N-API and Node-addon-api headers

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

napi-headers

ver Maintenance MIT dep size Known Vulnerabilities

npm CLI to download Node.js N-API headers and/or node-addon-api headers (for C++).

Getting Started

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

Usage example

When installed globally the nodehead (or napihead) executable will be exposed in your terminal.

$ nodehead -c -o ./include

API

napi-headers can be used as an API as well.

const headers = require("napi-headers");

headers.napi(process.cwd()).catch(console.error)

napi(dest: string, version?: string): void

Download N-API headers at the given destination. Version must be a valid Node.js release version (take a look here).

nodeAddonApi(dest: string, version?: string): void

Download Node-addon-api headers at the given destination. Version must be a valid node-addon-api package version.

Arguments

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 !

Download a given version of Node.js N-API headers

If you want to download headers for a specific version of Node.js, just write:

$ nodehead -n v11.0.0

Download a given version of Node-addon-api package

If you want to download a given version of node-addon-api (for headers), just write:

$ nodehead -c 1.6.0

License

MIT

About

npm CLI to download Node.js N-API and Node-addon-api headers

License:MIT License


Languages

Language:JavaScript 100.0%