ohmybuck

Node Current Directory

April 27, 2020

Working with the following directory structure

.
├── package.json
├── scripts
│   └── new-post
│       ├── index.js
│       └── post.md.tpl
└── static
    ├── CNAME
    ├── favicon.ico
    └── robots.txt

Running the hypothetical script node scripts/new-post/index.js will produce the following

process.cwd()
// .

__dirname
// scripts/new-post

Written by Oliver Smit. I love talking about web technologies, good design practices, optimising productivity, and rapid prototyping of projects. Check out my work on Github