Native-Addon-Sample-Package is a NPM package that allows for a simple C++ library to be run in Node.js projects using node-gyp The point of this package was to simply tests process of writing an NPM package using C++.
- Python v3.7, v3.8, v3.9, or v3.10
- Python v3.7, v3.8, v3.9, or v3.10
- Install Visual C++ Build Environment: Visual Studio Build Tools (using "Visual C++ build tools" workload) or Visual Studio Community (using the "Desktop development with C++" workload)
- For more info see the
node-gyp
dependencies (click here))
Use the package manager npm to install Native-Addon-Sample-Package
.
npm i native-addon-sample-package
const addon = require('native-addon-sample-package')
// returns 'dog'
console.log(addon.once('dog'))
// returns 'cat cat'
console.log(addon.twice('cat'))
// returns 'bird bird bird'
console.log(addon.triple('bird'))
This package uses Mocha for testing.
npm run test
The package can be run locally after globally installing node-gyp.
node-gyp rebuild
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
Please make sure to update tests as appropriate.