RSSAmplifier

Blog

Node.js Addons

nodeaddons.comRSS feed ↗10 posts

Latest posts

Cross-platform addons with node-pre-gyp

Node.js applications (including electron apps) are deployed everywhere, including end-user machines without a full development stack. Usually this is no problem - but things get complicated with native addons are used. Native C++ addons are distributed as modules, but npm builds them on the target machine during the install using node-gyp. node-gyp isn’t a compiler, it’s a build system that adapts…

Streaming data into a Node.js C++ Addon

Earlier this year I posted an article showing how we can build event-based and streaming interfaces for sending data from Node.js C++ addons to JavaScript. This mode of interacting with addons can be a lot easier in some situations, especially when your C++ code runs asynchronously. In this post, I’m going to use the streaming-worker and streaming-worker-sdk modules - which I’ve adapted from the…

Buffers and C++ on Rising Stack - Community

It’s been a few months since I’ve posted to this blog and I wanted to link to an article I’ve been working on that just appeared on Rising Stack’s new Community blog. The article - Using Buffers to share data between Node.js and C++ is all about making use of Buffers to efficiently move data between JavaScript and C++ - including asynchronous addons with worker threads..

C++ Addons as AWS Lambda functions

In this post I’m going to walk you through creating and deploying a Node.js AWS Lambda function that uses a native C++ addon. As you’ll see, the process isn’t much different than creating normal AWS Lambda functions with Node.js - you’ll just need to get your development environment to match the requirements for AWS.

Streaming data from C++ to Node.js

If you’ve worked with C++ addons for Node.js before, you know there’s a lot of work that goes into making them play well with the rest of your JavaScript program. Once you learn how to keep up with V8 changes using NAN and how to deal with C++/JavaScript data type conversions, you also need to deal with asynchronous addon functions. The asynchronous pattern - which I’ve posted about before - is…

C++ and Node.js Integration - eBook Published

I’ve got good news, I’ve finally completed the C++ and Node.js Integration ebook! I want to thank all of you for signing up for my newsletter to keep posted about the book - you kept me motivated! Thanks also to all the people who reached out to me with ideas, tips, and insights into the topic - you were extremely helpful.

Type conversions from JavaScript to C++ in V8

Learning how to pass information from JavaScript to C++ addons can be tricky. Confusion stems from the extreme differences between the JavaScript and C++ type system. While C++ is strongly typed (“42” is not an integer… it’s a string, and only a string!), JavaScript is very eager to convert datatypes for us.

How (not) to access V8 memory from a Node.js C++ addon’s worker thread

When we create C++ addons for Node.js, we have two strategies - synchronous or asynchronous processing. A synchronous C++ addon does it’s number crunching in the thread that Node.js’s event loop executes in. This, unfortunately, blocks all JavaScript execution until the C++ addon completes it’s work and returns control back to JavaScript. In asynchronous addons, we can execute the heavy lifting in…

Async Addons with Nan for the New Year (and eBook content updates)

Happy New Year everyone! Last month I let you all know I was starting a blog series about Getting C++ to the Web using Node.js. My plan was to get the whole series out by the end of the year, and I just made it! The last part was posted just a couple of days ago, it focused on asynchronous addons using Nan. I also covered automation and shared libraries along the way.

Building an Asynchronous C++ Addon for Node.js using Nan

This post is the fourth and final in a series dedicated to showing you how to get your C++ application onto the web by integrating with Node.js. In the first post, I outlined three general options: