Retrive application data directory in node.js

My node.js application needs to store large quantities of binary data. Using local filesystem seems to be appropriate solution, but application data directories are placed in different location depending on host system.

What is a system-independent way to retrieve application data directory (like %appdata%\appname, or ~/.appname)?

getting the current direcory: __dirname

if you want to get another Global variable for example an application directory then:

process.env.ENV_VARIABLE

Where ENV_VARIABLE is the name of the variable you wish to access

You can also check nconf it is a "Hierarchical node.js configuration with files, environment variables, command-line arguments, and atomic object merging"