Home
Docs
GitHub
Pricing
Blog
Log In

Run Sandworm Audit for your App

Get started
Hold on, we're currently generating a fresh version of this report
Generated on May 20, 2024 via pnpm

node-addon-api 6.1.0

Node.js API (Node-API)
Package summary
Share
0
issues
1
license
1
MIT
Package created
4 May 2017
Version published
20 Apr 2023
Maintainers
7
Total deps
1
Direct deps
0
License
MIT

Issues

0
This package has no issues

Licenses

MIT License

Permissive
OSI Approved
This is a human-readable summary of (and not a substitute for) the license. Disclaimer.
Can
commercial-use
modify
distribute
sublicense
private-use
Cannot
hold-liable
Must
include-copyright
include-license
1 Packages, Including:
node-addon-api@6.1.0
Disclaimer

This deed highlights only some of the key features and terms of the actual license. It is not a license and has no legal value. You should carefully review all of the terms and conditions of the actual license before using the licensed material.

Sandworm is not a law firm and does not provide legal services. Distributing, displaying, or linking to this deed or the license that it summarizes does not create a lawyer-client or any other relationship.

Direct Dependencies

0
All Dependencies CSV
β“˜ This is a list of node-addon-api 's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.
NameVersionSizeLicenseTypeVulnerabilities

Visualizations

Frequently Asked Questions

What does node-addon-api do?

Node-addon-api is a beneficial package that serves as an abstraction layer above the Node.js C++ API (Node-API). It simplifies the creation of Native Addons for Node.js by providing a higher level, more JavaScript like API for working with Node's JavaScript data types and object properties. It means, with the help of node-addon-api, developers are able to perform direct operations on JavaScript objects from C++ code much efficiently.

How do you use node-addon-api?

To utilize the node-addon-api, you must first install it via npm, which stands for Node.js package manager. You can perform the installation using the terminal/command-line interface with the command npm install node-addon-api. After that, you need to include the module in your project's binding.gyp file:

'include_dirs' : ["<!(node -p \"require('node-addon-api').include\")"]

Then, in your C++ code, include the napi.h header file at the top:

#include <napi.h>

The inclusion of this header will provide you access to the Node-addons-API. Now you can start using the API to manipulate JavaScript objects from C++ code. For instance:

Napi::Object HelloWorld(const Napi::CallbackInfo& info) {
    Napi::Env env = info.Env();
    return Napi::String::New(env, "Hello, World!");
}

This example function returns a new JavaScript string when called from JavaScript.

Where are the node-addon-api docs?

For the comprehensive documentation on node-addon-api, you can visit the official GitHub page at git://github.com/nodejs/node-addon-api.git. The napi.h file also includes comments which make for detailed documentation of the API's functionalities.