EN
TypeScript / Node.js - get current directory
6 points
In this article, we would like to show you how to get the current directory in Node.js.
As current directory we can understand:
It is context directory where script is currently run. That directory can be used to read input data and save current work results. As example we can use Quick solution: xxxxxxxxxx 1 const directory = process.cwd(); | |
current script directory |
It is directory where script is located. Quick solution: xxxxxxxxxx 1 const directory: string = __dirname; |