Get entries from administrative databases for Node.js
Get entries from administrative databases for Node.js.
It's Node.js implementation of the features in the getent system command.
Some systems don't use files like
For example if you are using a LDAP-based systems you must use standard system calls.
By using calls you don't need to bother what type of database the system is currently using.
You can install it using NPM:
npm install getent
Currently supports only these database:
Generic stuff to do:
- Write unit tests
- Setup travis-ci
Implement these new databases:
- Database passwd - Implement
getpwuid-- Current search does NOT use these!
- Database group - Implement
- Database hosts - Implement
- Database services - Implement
- Database protocols - Implement
- Database networks - Implement
Also maybe these (which were not documented for getent command):
- Database shadow - Implement
- Database alias - Implement
- Database rpc - Implement
- Database tty - Implement
- Database mnt - Implement
If this library some day has more features than the original command, then it should have runnable
node-getent when installed globally.
Feel free to submit issues if you would like to see another feature or would need one of these implemented sooner. I'll accept pull requests, too!
First you must define
getent like this (did you expect something else?):
var getent = require'getent';
Fetch all users using a callback:
getentpasswdconsole.log JSONstringifyuser ;;
Fetch all users by returning an array:
var users = getentpasswd;
Fetch single user:
var users = getentpasswd"root";
Fetch two users:
var users = getentpasswd"root" "nobody";