I am Hack Sparrow
Captain of the Internets.

Archive for May, 2014

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 them might seem to refer to the same thing, they can become a source of confusion and bugs, if they are not understood well. Let's examine how they work. Create a directory named base with the following tree under it: [code] . ├── app.js └── /one ├── on ...