Initial commit
[yaffs-website] / node_modules / homedir-polyfill / README.md
1 # homedir-polyfill [![NPM version](https://img.shields.io/npm/v/homedir-polyfill.svg?style=flat)](https://www.npmjs.com/package/homedir-polyfill) [![NPM downloads](https://img.shields.io/npm/dm/homedir-polyfill.svg?style=flat)](https://npmjs.org/package/homedir-polyfill) [![Linux Build Status](https://img.shields.io/travis/doowb/homedir-polyfill.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/homedir-polyfill) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/homedir-polyfill.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/doowb/homedir-polyfill)
2
3 > Node.js os.homedir polyfill for older versions of node.js.
4
5 ## Install
6
7 Install with [npm](https://www.npmjs.com/):
8
9 ```sh
10 $ npm install --save homedir-polyfill
11 ```
12
13 ## Usage
14
15 ```js
16 var homedir = require('homedir-polyfill');
17 console.log(homedir());
18 //=> /Users/doowb
19 ```
20
21 ## Reasoning
22
23 This library is a polyfill for the [node.js os.homedir](https://nodejs.org/api/os.html#os_os_homedir) method found in modern versions of node.js.
24
25 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.
26
27 Since `/etc/passwd` is not available on windows platforms, this implementation will use environment variables to find the home directory.
28
29 In modern versions of node.js, [os.homedir](https://nodejs.org/api/os.html#os_os_homedir) is used.
30
31 ## About
32
33 ### Related projects
34
35 [parse-passwd](https://www.npmjs.com/package/parse-passwd): Parse a passwd file into a list of users. | [homepage](https://github.com/doowb/parse-passwd "Parse a passwd file into a list of users.")
36
37 ### Contributing
38
39 Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
40
41 Please read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards.
42
43 ### Building docs
44
45 _(This document was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme) (a [verb](https://github.com/verbose/verb) generator), please don't edit the readme directly. Any changes to the readme must be made in [.verb.md](.verb.md).)_
46
47 To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
48
49 ```sh
50 $ npm install -g verb verb-generate-readme && verb
51 ```
52
53 ### Running tests
54
55 Install dev dependencies:
56
57 ```sh
58 $ npm install -d && npm test
59 ```
60
61 ### Author
62
63 **Brian Woodward**
64
65 * [github/doowb](https://github.com/doowb)
66 * [twitter/doowb](http://twitter.com/doowb)
67
68 ### License
69
70 Copyright © 2016, [Brian Woodward](https://github.com/doowb).
71 Released under the [MIT license](LICENSE).
72
73 ***
74
75 _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 19, 2016._