{"id":13669735,"url":"https://github.com/BoogeeDoo/real-homedir","last_synced_at":"2025-04-27T08:32:53.077Z","repository":{"id":57348822,"uuid":"53035810","full_name":"BoogeeDoo/real-homedir","owner":"BoogeeDoo","description":"Get real home directory in node.js.","archived":false,"fork":false,"pushed_at":"2016-03-12T14:21:57.000Z","size":15,"stargazers_count":8,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-15T21:41:51.288Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/BoogeeDoo.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-03-03T08:57:14.000Z","updated_at":"2024-08-29T17:43:50.000Z","dependencies_parsed_at":"2022-09-18T22:33:45.355Z","dependency_job_id":null,"html_url":"https://github.com/BoogeeDoo/real-homedir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoogeeDoo%2Freal-homedir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoogeeDoo%2Freal-homedir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoogeeDoo%2Freal-homedir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BoogeeDoo%2Freal-homedir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BoogeeDoo","download_url":"https://codeload.github.com/BoogeeDoo/real-homedir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251112606,"owners_count":21538162,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T09:00:20.937Z","updated_at":"2025-04-27T08:32:52.243Z","avatar_url":"https://github.com/BoogeeDoo.png","language":"C++","funding_links":[],"categories":["C++"],"sub_categories":[],"readme":"# Real Homedir\n\n[![Real Homedir](http://img.shields.io/npm/v/real-homedir.svg)](https://www.npmjs.org/package/real-homedir)\n[![Real Homedir](http://img.shields.io/npm/dm/real-homedir.svg)](https://www.npmjs.org/package/real-homedir)\n[![Build Status](https://travis-ci.org/BoogeeDoo/real-homedir.svg?branch=master)](https://travis-ci.org/BoogeeDoo/real-homedir)\n[![Coverage Status](https://img.shields.io/coveralls/BoogeeDoo/real-homedir/master.svg)](https://coveralls.io/r/BoogeeDoo/real-homedir?branch=master)\n[![License](https://img.shields.io/npm/l/real-homedir.svg?style=flat)](https://www.npmjs.org/package/real-homedir)\n[![Dependency Status](https://david-dm.org/BoogeeDoo/real-homedir.svg)](https://david-dm.org/BoogeeDoo/real-homedir)\n\nGet real home directory in node.js.\n\n## Why This Package?\n\nConsider this situation:\n\nYou're user **blah**. You run command `$ sudo -u foo node bar.js` and `bar.js` will write some file in executor's (**foo**) home directory.\n\n### $HOME\n\nWhen you use `process.env.HOME` in `bar.js` with above command, you may won't get `/home/foo` but get `/home/blah`.\n\n### os.homedir()\n\nWhen you use `os` module shown below:\n\n```javascript\nconst os = require(\"os\");\nconsole.log(os.homedir());\n```\n\nYou may won't get `/home/foo` but get `/home/blah` too due to code of [node.js](https://github.com/nodejs/node/blob/v4.3.2/src/node_os.cc#L274-L290) and [libuv](https://github.com/libuv/libuv/blob/v1.8.0/src/unix/core.c#L1032).\n\n### So\n\nYou need this package to get the real home directory of current executor due to the situation above, and not only the situation above!\n\n## Installation\n\n```sh\n$ npm install -d --save real-homedir\n```\n\n## Usage\n\nRequire this package first:\n\n```javascript\nconst homedir = require(\"real-homedir\");\n```\n\nAnd just call it.\n\n```javascript\nconst hd = homedir();\n```\n\nThen you will get the real home directory!\n\n## Contribution\n\nYou're welcome to make pull requests!\n\n「雖然我覺得不怎麼可能有人會關注我」\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBoogeeDoo%2Freal-homedir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FBoogeeDoo%2Freal-homedir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FBoogeeDoo%2Freal-homedir/lists"}