node-addon-api is the C++ wrapper for N-API, the ABI stable library to build addons for Node.js.
Questions tagged [node-addon-api]
126 questions
0
votes
1 answer
Deep copy NAPI::Value Object
I am writing a Node addon in (mostly) C++ that needs to copy a NAPI::Value instance from a child process to the parent process. I need to know how to do this. Looking at the NAPI source code I see that the Value class has two fields of types…

drew.neely
- 126
- 1
- 13
0
votes
0 answers
How can I force visual studio to find a header file when opening a folder
Visual Studio 2019 does not discover napi.hunless I use relative paths while opening a npm project as a folder. The file is located in node_modules/node-addon-api/napi.h. How can I force VS to find this header? Is there an Additional include…

user3238415
- 188
- 1
- 11
0
votes
2 answers
How to use InstanceMethod() to wrap a method returning an Object?
Working on creating an add-on that will return an Object to the node environment. Basing my work on Atul Anand's introduction to N-API in C++, the methods of the class object are wrapped in InstanceMethod() to expose them; but that function wants a…

Mike C
- 1,224
- 10
- 26
0
votes
0 answers
Filling in HTML select tag from C++ addon function call
I'm just not sure how to approach this. I have a blank select tag in my HTML with JS handling click events. I then have a addon built that builds some objects from other sources each containing an unique identifying string.
How would I go about…

Yang Lu
- 3
- 4
-1
votes
1 answer
Return Boolean value in node c++ addon
In Node C++ Addon, I can return a String like this:
void Method(const FunctionCallbackInfo& args) {
Isolate* isolate = args.GetIsolate();
args.GetReturnValue().Set(
String::NewFromUtf8(isolate, "hello")
.ToLocalChecked()
…

Emad Omar
- 729
- 9
- 23
-1
votes
1 answer
Calling JS function multiple times from node addon
Edit: apparently it's not clear, guess I'll make it more concise.
Node application is built, uses a native addon. I need to pass in a Javascript function from this project through node-addon-api into my C++ addon. Then, I need to be able to call…

Yang Lu
- 3
- 4