Socket
Socket
Sign inDemoInstall

parse-passwd

Package Overview
Dependencies
0
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    parse-passwd

Parse a passwd file into a list of users.


Version published
Weekly downloads
6.7M
decreased by-13.93%
Maintainers
1
Install size
6.62 kB
Created
Weekly downloads
 

Package description

What is parse-passwd?

The parse-passwd npm package is designed to parse the /etc/passwd file from Unix/Linux systems. This file contains user account information, and parsing it can be useful for system administration, security analysis, and user management tasks. The package provides a simple interface to convert the content of the /etc/passwd file into a JavaScript object for easy manipulation and access.

What are parse-passwd's main functionalities?

Parsing /etc/passwd file content

This feature allows you to parse the content of an /etc/passwd file. The code sample demonstrates how to use the parse-passwd package to convert a string representing the content of an /etc/passwd file into an array of user objects. Each object contains information about a user, such as username, password, UID, GID, full name, home directory, and shell.

const parsePasswd = require('parse-passwd');
const passwdContent = 'root:x:0:0:root:/root:/bin/bash\n';
const users = parsePasswd(passwdContent);
console.log(users);

Other packages similar to parse-passwd

Readme

Source

parse-passwd NPM version NPM downloads Linux Build Status Windows Build Status

Parse a passwd file into a list of users.

Install

Install with npm:

$ npm install --save parse-passwd

Usage

var parse = require('parse-passwd');

API

Example

// assuming '/etc/passwd' contains:
// doowb:*:123:123:Brian Woodward:/Users/doowb:/bin/bash
console.log(parse(fs.readFileSync('/etc/passwd', 'utf8')));

//=> [
//=>   {
//=>     username: 'doowb',
//=>     password: '*',
//=>     uid: '123',
//=>     gid: '123',
//=>     gecos: 'Brian Woodward',
//=>     homedir: '/Users/doowb',
//=>     shell: '/bin/bash'
//=>   }
//=> ]

Params

  • content {String}: Content of a passwd file to parse.
  • returns {Array}: Array of user objects parsed from the content.

About

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.

Keywords

FAQs

Last updated on 19 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc