• Node.js: Base64 encoding and decoding

    How to Base64 encode and decode in Node.js Here is how you encodetext to base64 in Node.js: var b = new Buffer('JavaScript'); var s = b.toString('base64'); // SmF2YVNjcmlwdA== And here is how you dec...

  • Nodejs Error: Could not autodetect OpenSSL support

    OpenSSL development packages not installed So you are ready to install Node on your Ubuntu box and run ./configure, to which you are greeted by a nasty looking error: Could not autodetect OpenSSL sup...

  • Developing command-line tools with Node.js

    In this tutorial I showed how to turn a regular Node.js program into a "feature-rich" command-line tool. The magic lies in the shebang interpreter directive (#!/usr/bin/env node), the bin property of...

  • Node.js: Difference between spawn and exec of child_process

    What is the difference between spawn and exec methodd of child_process? The Node.js child_process module has two methods spawn() and exec(), using which we can start a child process to execute other ...

  • Node.js: Directory references

    Understanding directory references in Node.js So, there are three different ways to refer to directories in Node.js; namely - dot notation (./ and ../), __dirname, and process.cwd(). While all of the...

  • Node.js EventEmitter Tutorial with Examples

    Heard about Node.js' EventEmitter class? Maybe you know that most of the built-in Node libraries use it? Maybe you were always curious about EventEmitter, but had no one to explain it to you? In this...

  • Node.js: exports vs module.exports

    What is the difference between exports and module.exports in Node.js? Let's first take a look at what the module object is all about. Create a file named run.js with the following content.