2

I'm creating a global module that will offer a few command line executables, and I'm wondering where is the best place to store configuration options for the module. For example, npm has the npm adduser command that registers a user account (in the .npmrc file located in the user's home directory). My question is this: if I need to store configuration and/or cached files, is the best practice to use something like:

function getUserHome() {
  return process.env.HOME || process.env.HOMEPATH || process.env.USERPROFILE;
}

To find the user's home directory in platform agnostic way, and then create my configuration folder in there (presumably prefixed by ., so it is hidden on unix machines)?

Community
  • 1
  • 1
Sanuden
  • 395
  • 3
  • 13

0 Answers0