8.0.0 • Published 4 months ago

node-addon-api v8.0.0

Weekly downloads
3,822,677
License
MIT
Repository
github
Last release
4 months ago

node-addon-api module

This module contains header-only C++ wrapper classes which simplify the use of the C based N-API provided by Node.js when using C++. It provides a C++ object model and exception handling semantics with low overhead.

N-API is an ABI stable C interface provided by Node.js for building native addons. It is independent from the underlying JavaScript runtime (e.g. V8 or ChakraCore) and is maintained as part of Node.js itself. It is intended to insulate native addons from changes in the underlying JavaScript engine and allow modules compiled for one version to run on later versions of Node.js without recompilation.

The node-addon-api module, which is not part of Node.js, preserves the benefits of the N-API as it consists only of inline code that depends only on the stable API provided by N-API. As such, modules built against one version of Node.js using node-addon-api should run without having to be rebuilt with newer versions of Node.js.

It is important to remember that other Node.js interfaces such as libuv (included in a project via #include <uv.h>) are not ABI-stable across Node.js major versions. Thus, an addon must use N-API and/or node-addon-api exclusively and build against a version of Node.js that includes an implementation of N-API (meaning a version of Node.js newer than 6.14.2) in order to benefit from ABI stability across Node.js major versions. Node.js provides an ABI stability guide containing a detailed explanation of ABI stability in general, and the N-API ABI stability guarantee in particular.

As new APIs are added to N-API, node-addon-api must be updated to provide wrappers for those new APIs. For this reason node-addon-api provides methods that allow callers to obtain the underlying N-API handles so direct calls to N-API and the use of the objects/methods provided by node-addon-api can be used together. For example, in order to be able to use an API for which the node-addon-api does not yet provide a wrapper.

APIs exposed by node-addon-api are generally used to create and manipulate JavaScript values. Concepts and operations generally map to ideas specified in the ECMA262 Language Specification.

Current version: 1.7.1

(See CHANGELOG.md for complete Changelog)

NPM NPM

Setup

API Documentation

The following is the documentation for node-addon-api.

Examples

Are you new to node-addon-api? Take a look at our examples

Tests

To run the node-addon-api tests do:

npm install
npm test

To avoid testing the deprecated portions of the API run

npm install
npm test --disable-deprecated

Debug

To run the node-addon-api tests with --debug option:

npm run-script dev

If you want faster build, you might use the following option:

npm run-script dev:incremental

Take a look and get inspired by our test suite

Contributing

We love contributions from the community to node-addon-api. See CONTRIBUTING.md for more details on our philosophy around extending this module.

More resource and info about native Addons

WG Members / Collaborators

Active

NameGitHub Link
Anna Henningsenaddaleax
Gabriel Schulhofgabrielschulhof
Hitesh Kanwathirthadigitalinfinity
Jim Schlightjschlight
Michael Dawsonmhdawson
Kevin EadyKevinEady
Nicola Del GobboNickNaso

Emeritus

NameGitHub Link
Arunesh Chandraaruneshchandra
Benjamin Byholmkkoopa
Jason Ginchereaujasongin
Sampson Gaosampsongao
Taylor Wollboingoing

Licensed under MIT

vulkan.node.js@bitair/linker.c@proteria/webviewnodejiebaprivate@nuclearpowered/dropship-native-addon@appoptics/appoptics-bindingsnode-gameliftpogtopia-testdocksim-if-ctrust-wallet-core@bbingbbongbbangbbong/pulsar-clientnode-go-bridgenative-glut@keystore/node-scard@keystore/testnode_bindingdarknet_intuitivoencrypt-toolssimplemedia-nodejsnfc-pifile-cloak@buttonfly/simpledb@evasyst/kastextzego-express-electron-sdk-testkastext@bbingbbongbbangbbong/pulsar-client-node@rustyw0lf/rpi-led-matrixrivers.jsdepricateddocksim-if-sonodegui-bin-discord-qtsurveyor-data-mapperbasic-messageboxhomebridge-soil-moisture@shen9401/mode-addon-exampleplugins-ffixlsxio-writermkdir-nativechange-display-settings-native-testnode-linearnode-svm-napipcertaddonaccoders-sandboxaves-testkooperai-embeddingstransbasedidi_screenshot_addonstring-art-core@fintom/sha3-miner@appoptics/apm-binding-devnemeeting-sdk-test@coder-mike/micro-vmmac-permissionsnodewpiauph-node@brunogeroto/js-ftrscan-apikminjector@bwp91/noblenode-tds-sensordisplay-info@cipherstash/ore@zaber/motion-lib-alphacpu-archcryptojscwin-mouse-napiwintools-lmnodeaddonstypescriptstarter@glencfl/ffi-napi-binding@glencfl/ref-napi-bindingnode_paylinkwin-cursor@adam_inigo/ffi-napicuda-ts@cipherstash/beta-orefile-unlocker@openlegacydev/sybase-db@pubgcorp/pulsar-client@middleware.io/mw-node-apm@mapbox/vtcompositeencrypt-appcolourizedatkinpsy_scaleluck-mtptbsdpauph@infinitebrahmanuniverse/nolb-node-aproject-ephemeral-libraries@typescord/erlpack@typescord/opusrdiff-napi@fra.me/io-manager@fra.me/native-logger@fra.me/scanner-manager@fra.me/smart-card-manager@fra.me/usb-managerglasstron-clarityduckdb@everything-registry/sub-chunk-2297ffi-esm
8.0.0

4 months ago

7.1.0

6 months ago

7.0.0

1 year ago

6.1.0

1 year ago

5.1.0

2 years ago

6.0.0

1 year ago

5.0.0

2 years ago

4.3.0

2 years ago

4.2.0

3 years ago

4.1.0

3 years ago

4.0.0

3 years ago

3.2.1

3 years ago

3.2.0

3 years ago

3.1.0

4 years ago

3.0.2

4 years ago

3.0.1

4 years ago

2.0.2

4 years ago

1.7.2

4 years ago

2.0.1

4 years ago

3.0.0

4 years ago

2.0.0

5 years ago

1.7.1

5 years ago

1.7.0

5 years ago

1.6.3

5 years ago

1.6.2

6 years ago

1.6.1

6 years ago

1.6.0

6 years ago

1.5.0

6 years ago

1.4.0

6 years ago

1.3.0

6 years ago

1.2.0

7 years ago

1.1.0

7 years ago

1.0.0

7 years ago

0.6.3

7 years ago

0.6.2

7 years ago

0.5.1

7 years ago

0.5.0

7 years ago

0.4.0

7 years ago

0.3.5

7 years ago

0.3.4

7 years ago

0.3.1

7 years ago

0.3.0

7 years ago

0.2.0

7 years ago

0.1.0

7 years ago