1.0.114 • Published 6 years ago

system-folders v1.0.114

Weekly downloads
3
License
ISC
Repository
github
Last release
6 years ago

#system-folders

Result with standard folders appropriate by system.

A Note on extending paths... many people have a misconception that backslash ('\') is the only valid path character on windows. This is not true; instead windows accepts internall either forward-slash ('/') or backslash('\') as equivalent path separators. The only exception to this is when specifying a path that is on a remote computer share, in which case backslash('\') must be used as in '\\computer\share' but after that point forward slashses may be used. On all linux systems only '/' is valid.

Please leave issues on github for feature requests/fixes, questions, comments or criticisms. Or Gitter

##Usage

const systemFolders = require( '.' );
systemFolders( "myAppName" ); // configure paths to include my application's name

System Folders result Object fields

DirectoryDescription
homeCurrent users home directory
appDatawhere common application local data should be stored
documentscurrent user's document directory
downloadscurrent user's download directory
tempwhere to put temporary files

Win32 example output (without app name configured):

{
  home: C:\\Users\\Youzer,
  appData: 'C:\\Users\\Youzer\\AppData\\Local',
  documents: 'C:\\Users\\Youzer\\Documents',
  download: 'C:\\Users\\Youzer\\Downloads',
  temp: 'C:\\Users\\Youzer\\AppData\\Local\\Temp' 
}

Win32 example output (app name configured):

{
  home: C:\\Users\\Youzer,
  appData: 'C:\\Users\\Youzer\\AppData\\Local\\myAppName',
  documents: 'C:\\Users\\Youzer\\Documents\\myAppName',
  download: 'C:\\Users\\Youzer\\Downloads',
  temp: 'C:\\Users\\Youzer\\AppData\\Local\\Temp\\myAppName' 
}