Skip to content

Latest commit

 

History

History
71 lines (48 loc) · 2.1 KB

directory_locations.md

File metadata and controls

71 lines (48 loc) · 2.1 KB

📂 Directory locations

Typical directory locations are OS-specific.

Temporary directory

The main temporary directory could for example be:

  • /tmp on Linux.
  • /var/folders/.../T on Mac.
  • C:\Users\USER\AppData\Local\Temp on Windows.

os.tmpdir() can be used to retrieve it on any OS.

Different terminal sessions on the same machine might have different temporary directories on Windows.

Home directory

The user's home directory could for example be:

  • /home/USER on Linux.
  • /Users/USER on Mac.
  • C:\Users\USER on Windows.

os.homedir() can be used to retrieve it on any OS.

Application-specific settings are stored into subdirectories on Windows: Roaming (APPDATA environment variable) and Local (LOCALAPPDATA environment variable).

Cache directory

This is also OS-specific. global-cache-dir can be used to retrieve it on any OS.

Null device

This is /dev/null on Unix and \\.\nul on Windows. os.devNull can be used to retrieve it on any OS.

Other directories

env-paths can be used to retrieve other common directories for logging, configuration or application data on any OS.

Man pages

Man pages are Unix-specific so the package.json's man field does not have any effects on Windows.

Summary

Use os.tmpdir(), os.homedir(), global-cache-dir and env-paths.


Next (📂 File paths)
Previous (📂 Filesystem)
Top