Bachir Soussi Chiadmi ac58a24f5c added bower, gulp 7 年之前
..
LICENSE ac58a24f5c added bower, gulp 7 年之前
README.md ac58a24f5c added bower, gulp 7 年之前
index.js ac58a24f5c added bower, gulp 7 年之前
package.json ac58a24f5c added bower, gulp 7 年之前

README.md

homedir-polyfill NPM version NPM downloads Linux Build Status Windows Build Status

Node.js os.homedir polyfill for older versions of node.js.

Install

Install with npm:

$ npm install --save homedir-polyfill

Usage

var homedir = require('homedir-polyfill');
console.log(homedir());
//=> /Users/doowb

Reasoning

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.

About

Related projects

parse-passwd: Parse a passwd file into a list of users. | homepage

Contributing

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.

Building docs

(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

Running tests

Install dev dependencies:

$ npm install -d && npm test

Author

Brian Woodward

License

Copyright © 2016, Brian Woodward. Released under the MIT license.


This file was generated by verb-generate-readme, v0.2.0, on October 19, 2016.