• 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...

  • What is npx?

    What is npx? npx is a Node.js command-line tool which became available with npm@5.2.0. It enables npm to eXecute command-line Node.js tools without having them to be installed globally. Command-line ...

  • 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.

  • Node.js: Publishing an npm package

    How to publish a Node.js module on npm Before you can publish your Node.js module on npm, you have to create one. If you don't know how to create one, read "Node.js: Writing modules". Assuming you ar...

  • 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: Writing modules

    How to create Node.js modules A Node.js module is a standalone JavaScript program which exposes an object that can be imported and used by other programs. The object exposed by the module can be of a...