![]() |
VOOZH | about |
The process.cwd() method is an inbuilt application programming interface of the process module which is used to get the current working directory of the node.js process.
Syntax:
process.cwd()Parameters: This method does not accept any parameters. Return Value: This method returns a string specifying the current working directory of the node.js process.
The process.cwd() method returns the current working directory of the Node.js process.
Example 1: Below examples illustrate the use of process.cwd() method in Node.js:
Output:
Current working directory: C:\nodejs\g\processExample 2: Below examples illustrate the use of process.cwd() method in Node.js:
Output:
Current working directory: C:\nodejs\g\process
Working directory after changing directory: C:\nodejs\g\os
We have a Cheat Sheet on Node Process Methods where we covered all the process methods to check those please go through Node Process Complete Reference this article.