Node.js C++ integration sample code
C++ JavaScript Python
Switch branches/tags
Nothing to show
Clone or download
freezer333 Merge pull request #12 from zbjornson/master
Provide count to string ctors
Latest commit 9130c01 Oct 10, 2017

README.md

nodecpp-demo

This repository contains full code listings that help guide you through developing Node.js addons.

The content is fully explained on my blog - blog.scottfrees.com and is the subject of my ebook - C++ and Node.js Integration.

Basics

Some simple "hello world" type programs, discussed in the first chapter of the ebook.

Conversions

Code "cheat sheet" for passing different data types between C++ and JavaScript. See here for associated blog post. This is also covered in Chapter 2 of the ebook.

Conversions_NAN

The same "cheat sheet" as Conversions, but using the NAN API rather than native V8. Covered in Chapter 6 of the ebook.

Rainfall

Contains a full example of using objects, arrays, and asynchronous callbacks to exchange data between JavaScript and C++ library for doing some (trivial) number crunching. This supports a 4-part blog series, which starts here. Covered in Chapters 3 and 4 of the ebook.

Primes

A set of example addon functions demonstrating NAN's AsyncWorker and AsyncProgressWorker. Covered in Chapter 6 of the ebook.

ObjectWrap

An ObjectWrap example developing a C++ polynomial class. Covered in Chapter 5 of the ebook.

ObjectWrap_NAN

The same Polynomial class, but using NAN instead of direct Node.js API. Covered in Chapter 6 of the ebook.

Streaming

A complete SDK and set of examples for using NAN and asynchronous callbacks to stream data between C++ and JavaScript. This is the subject of Chapter 7 of the ebook.

Buffers

An example of using buffers to move data between JavaScript and a simple image processing C++ addon (converting PNG to BMP using LodePNG). This is covered in Appendix B of the ebook.

Packaging

A set of examples for building and distributing reusable addons. Covered in Chapter 8 of the ebook.