Node Current Directory

Updated May 26, 2024
Created 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

Comments?