1
|
# parse-passwd [![NPM version](https://img.shields.io/npm/v/parse-passwd.svg?style=flat)](https://www.npmjs.com/package/parse-passwd) [![NPM downloads](https://img.shields.io/npm/dm/parse-passwd.svg?style=flat)](https://npmjs.org/package/parse-passwd) [![Linux Build Status](https://img.shields.io/travis/doowb/parse-passwd.svg?style=flat&label=Travis)](https://travis-ci.org/doowb/parse-passwd) [![Windows Build Status](https://img.shields.io/appveyor/ci/doowb/parse-passwd.svg?style=flat&label=AppVeyor)](https://ci.appveyor.com/project/doowb/parse-passwd)
|
2
|
|
3
|
> Parse a passwd file into a list of users.
|
4
|
|
5
|
## Install
|
6
|
|
7
|
Install with [npm](https://www.npmjs.com/):
|
8
|
|
9
|
```sh
|
10
|
$ npm install --save parse-passwd
|
11
|
```
|
12
|
|
13
|
## Usage
|
14
|
|
15
|
```js
|
16
|
var parse = require('parse-passwd');
|
17
|
```
|
18
|
|
19
|
## API
|
20
|
|
21
|
**Example**
|
22
|
|
23
|
```js
|
24
|
// assuming '/etc/passwd' contains:
|
25
|
// doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash
|
26
|
console.log(parse(fs.readFileSync('/etc/passwd', 'utf8')));
|
27
|
|
28
|
//=> [
|
29
|
//=> {
|
30
|
//=> username: 'doowb',
|
31
|
//=> password: '*',
|
32
|
//=> uid: '123',
|
33
|
//=> gid: '123',
|
34
|
//=> gecos: 'Brian Woodward',
|
35
|
//=> homedir: '/Users/doowb',
|
36
|
//=> shell: '/bin/bash'
|
37
|
//=> }
|
38
|
//=> ]
|
39
|
```
|
40
|
|
41
|
**Params**
|
42
|
|
43
|
* `content` **{String}**: Content of a passwd file to parse.
|
44
|
* `returns` **{Array}**: Array of user objects parsed from the content.
|
45
|
|
46
|
## About
|
47
|
|
48
|
### Contributing
|
49
|
|
50
|
Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
|
51
|
|
52
|
Please read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards.
|
53
|
|
54
|
### Building docs
|
55
|
|
56
|
_(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).)_
|
57
|
|
58
|
To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
|
59
|
|
60
|
```sh
|
61
|
$ npm install -g verb verb-generate-readme && verb
|
62
|
```
|
63
|
|
64
|
### Running tests
|
65
|
|
66
|
Install dev dependencies:
|
67
|
|
68
|
```sh
|
69
|
$ npm install -d && npm test
|
70
|
```
|
71
|
|
72
|
### Author
|
73
|
|
74
|
**Brian Woodward**
|
75
|
|
76
|
* [github/doowb](https://github.com/doowb)
|
77
|
* [twitter/doowb](http://twitter.com/doowb)
|
78
|
|
79
|
### License
|
80
|
|
81
|
Copyright © 2016, [Brian Woodward](https://github.com/doowb).
|
82
|
Released under the [MIT license](LICENSE).
|
83
|
|
84
|
***
|
85
|
|
86
|
_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 19, 2016._
|