The nodejs has global variables which are associated with the process/application its running.

The entire documentation for process variable can be found here :

A sample usage is getting current working directory and escaping the special characters like spaces. This is again dependent on platform.

We do something like below code to escape space character and other similar character to get current working directory as string in nodejs apps.

escapeChar = process.platform.match(/^win/) ? ‘^’ : ‘\\’,
cwd = process.cwd().replace(/( |\(|\))/g, escapeChar + ‘$1’),

We can also use the process global variable to exit process with