I've got some existing C++ code that does numerical processing within a stand-alone C++ application. I now want to use that code within a new node.js application.
Researching how to access C++ code from node.js, two options come up:
Write a node.js…
I am looking to working on a project using node js addons with C++. I came across two abstract library NAN and N-API that I can use. However I am unable to decide which one I should use. I was not able to find proper comparison between these two…
A quick google search yields at least one tutorial for writing a C++ "Hello World" for node.js, but it's unclear if it's possible to write such an extension using only C. Assuming it is possible, what challenges / limitations would I face?
I am writing a custom node.js addon by C++ mixed with C program.
The addon.cc consists of something like
#define BUILDING_NODE_EXTENSION
#include
#include
using namespace v8;
using namespace node;
/* other logic and…
I have a Node C++ Addon that provides a wrapped class similar to the one in the Node documentation. I can require() my addon and then get the constructor for my class to create an instance.
const { MyClass } = require('myaddon');
const obj = new…
I'm trying to integrate an external C++ library (I have access to the .so file as well as the header files) into my Node.js application.
After a lot of research my options are reduced to:
Writing a Node addon
Use node-ffi
From node-ffi's…
The docs for AsyncContext have this example (only slightly modified, but still working) that works synchronously:
#include "napi.h"
void MakeCallbackWithAsyncContext(const Napi::CallbackInfo& info)
{
Napi::Function callback =…
I need to use node.js built in module 'crypto' from my C++ addon.
I tried to find examples of C++ addons which use built in modules, but failed.
I looked in node_crypto.h/.cc and it has so different function signatures comparing with node.js crypto…
I've been looking through the NAPI documentation to try and understand how it deals with multithreading. According to the documentation napi_create_threadsafe_function() and napi_call_threadsafe_function() are used to create and call js functions…
I am building a C++ addon for NodeJS and I want to stream data asynchronously from C++ to Node. I have found this article, https://nodeaddons.com/streaming-data-into-a-node-js-c-addon/, however; I want to use the N-API instead of NAN.
I have been…
I am noob at Js but trying to make life easier by writing api to transfer files from irc to my server
After some digging I got a module that downloads file (code below based on npm xdcc) but when I run the module it doesn't exit after completing…
As normal C++ execl works fine (compiling with g++ ok.cc -o ok.elf)
#include
int main(){
execl("/usr/bin/python", "/usr/bin/python", nullptr);
}
But crashes, when works as node.js C++ addon
#include
#include…
I try to setup debugging in visual studio code for a C++ Node-Addon compiled with GYP. I want to step through the source-code if possible. I use typescript as my server language and include the ".node" file compiled by gyp. This works fine but how…