Skip to content

dabos-GFI/grp

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grp NPM version

<grp.h> binding for node.

var fs = require('fs');
var grp = require('grp');

var stat = fs.statSync(path);

var group = grp.getgrgid(stat.gid);
console.log('the group name for "' + path + '" is: ' + group.gr_name);

Installation

$ npm install grp --save

Features

There is two available functions:

  • getgrgid(gid)
    var group = grp.getgrgid(10);
  • getgrnam(name)
    var group = grp.getgrnam('wheel');

These functions obtain information from opendirectoryd(8), including records in /etc/group which is described in group(5). Each line of the database is defined by the structure group like found in the include file <grp.h>:

{
    gr_name        /* group name */
    gr_passwd,     /* group password - NOT SUPPORTED IN V1.0.0 */
    gr_gid,        /* group id */
    gr_mem         /* group members - NOT SUPPORTED IN V1.0.0 */
}

More Information

$ man 3 getgrgid

License

MIT