Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

uid-number

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

uid-number

Convert a username/group name to a uid/gid number

  • 0.0.6
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
529K
decreased by-23.73%
Maintainers
1
Weekly downloads
 
Created

What is uid-number?

The uid-number npm package is used to convert a username/group name into a numeric user id (UID) and group id (GID). It is a simple utility that can be useful when dealing with file system permissions in Node.js applications, especially when interfacing with native system file permissions where numerical IDs are required.

What are uid-number's main functionalities?

Convert username to UID

This feature allows you to convert a given username to its corresponding numeric user ID (UID). The function takes a username as its first argument and a callback as the second argument. The callback receives an error object (if any), the UID, and the GID associated with the username.

const uidNumber = require('uid-number');
uidNumber('username', (err, uid, gid) => {
  if (err) {
    console.error('Error getting UID:', err);
  } else {
    console.log('UID:', uid);
  }
});

Convert group name to GID

This feature allows you to convert a given group name to its corresponding numeric group ID (GID). The function takes a group name as its second argument and a callback as the third argument. The callback receives an error object (if any), the UID (which is undefined in this case), and the GID associated with the group name.

const uidNumber = require('uid-number');
uidNumber(undefined, 'groupname', (err, uid, gid) => {
  if (err) {
    console.error('Error getting GID:', err);
  } else {
    console.log('GID:', gid);
  }
});

Other packages similar to uid-number

FAQs

Package last updated on 12 Nov 2014

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc