You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

85 lines
2.4 KiB

4 years ago
  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. > Parse a passwd file into a list of users.
  3. ## Install
  4. Install with [npm](https://www.npmjs.com/):
  5. ```sh
  6. $ npm install --save parse-passwd
  7. ```
  8. ## Usage
  9. ```js
  10. var parse = require('parse-passwd');
  11. ```
  12. ## API
  13. **Example**
  14. ```js
  15. // assuming '/etc/passwd' contains:
  16. // doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash
  17. console.log(parse(fs.readFileSync('/etc/passwd', 'utf8')));
  18. //=> [
  19. //=> {
  20. //=> username: 'doowb',
  21. //=> password: '*',
  22. //=> uid: '123',
  23. //=> gid: '123',
  24. //=> gecos: 'Brian Woodward',
  25. //=> homedir: '/Users/doowb',
  26. //=> shell: '/bin/bash'
  27. //=> }
  28. //=> ]
  29. ```
  30. **Params**
  31. * `content` **{String}**: Content of a passwd file to parse.
  32. * `returns` **{Array}**: Array of user objects parsed from the content.
  33. ## About
  34. ### Contributing
  35. Pull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).
  36. Please read the [contributing guide](contributing.md) for avice on opening issues, pull requests, and coding standards.
  37. ### Building docs
  38. _(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).)_
  39. To generate the readme and API documentation with [verb](https://github.com/verbose/verb):
  40. ```sh
  41. $ npm install -g verb verb-generate-readme && verb
  42. ```
  43. ### Running tests
  44. Install dev dependencies:
  45. ```sh
  46. $ npm install -d && npm test
  47. ```
  48. ### Author
  49. **Brian Woodward**
  50. * [github/doowb](https://github.com/doowb)
  51. * [twitter/doowb](http://twitter.com/doowb)
  52. ### License
  53. Copyright © 2016, [Brian Woodward](https://github.com/doowb).
  54. Released under the [MIT license](LICENSE).
  55. ***
  56. _This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.2.0, on October 19, 2016._