Creating Node Addons, C/C++ extensions for fun and profit
summary
Builds a working bcrypt Node addon into a single bcrypt.node module that exposes gen_salt and bcrypt functions, converts JS strings to UTF‑8 char and back to V8 strings, and returns the encrypted result. Uses V8 APIs: local handles, HandleScope and persistent handles, ObjectWrap, and node_set_prototype_method; fixes early segfaults by closing scopes. Claims typical JS→C++ speedups of two orders of magnitude* and shows the init/constructor/export plumbing that makes the module require‑able.
AI-written summary · about
chapters (12)
- 0:00Intro
- 2:09What are Node Addons
- 3:40Why would anyone want to do this
- 5:08Bcrypt
- 6:40Addon
- 7:20How does it work
- 8:28Basic code
- 12:35Handle scopes
- 16:12Object wrap
- 19:07Ref and signatures
- 20:55Bcrypt module
- 21:41Bcrypt code








