Node.js os.homedir polyfill for older versions of node.js.
Install with npm:
$ npm install --save homedir-polyfill
var homedir = require('homedir-polyfill');
console.log(homedir());
//=> /Users/doowb
This library is a polyfill for the node.js os.homedir method found in modern versions of node.js.
This implementation tries to follow the implementation found in libuv
by finding the current user using the process.geteuid()
method and the /etc/passwd
file. This should usually work in a linux environment, but will also fallback to looking at user specific environment variables to build the user's home directory if neccessary.
Since /etc/passwd
is not available on windows platforms, this implementation will use environment variables to find the home directory.
In modern versions of node.js, os.homedir is used.
parse-passwd: Parse a passwd file into a list of users. | homepage
Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
Please read the contributing guide for avice on opening issues, pull requests, and coding standards.
(This document was generated by verb-generate-readme (a verb generator), please don't edit the readme directly. Any changes to the readme must be made in .verb.md.)
To generate the readme and API documentation with verb:
$ npm install -g verb verb-generate-readme && verb
Install dev dependencies:
$ npm install -d && npm test
Brian Woodward
Copyright © 2016, Brian Woodward. Released under the MIT license.
This file was generated by verb-generate-readme, v0.2.0, on October 19, 2016.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.