Last active
August 24, 2016 10:34
-
-
Save potato4d/fd7ff6e3a05d268269ea18ac71dcddc4 to your computer and use it in GitHub Desktop.
Node.jsでユーザーのホームディレクトリのパスを取得する ref: http://qiita.com/potato4d/items/7131028497de53ceb48e
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const path = require("path"); | |
| const userHome = process.env[process.platform == "win32" ? "USERPROFILE" : "HOME"]; | |
| console.log(path.join(userHome, "Desktop")); | |
| // /Users/foo/Desktop | |
| console.log(path.join(userHome, "Documents")); | |
| // /Users/foo/Documents |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment