NODEJS get username current node.js - Net-Raft.com

Welcome aboard! We are happy you are here and wish you good net-raft!




Just a Web Code Solution

how to get the username of the current user using node.js ?


 165

NODEJS


1

// at first you install: npm install --save username

const username = require('username');

username().then(username => {
console.log(username);
});


By     Created   
The power of the user (%)
42%

NODEJS


0

// try this ... this works
// at first you install "npm install --save path"

//put this code into app.js

var path = require('path');
var userName = process.env['USERPROFILE'].split(path.sep)[2];
var loginId = path.join("domainName",userName);
console.log(loginId);

// type "node app.js" in command prompt


By     Created   
The power of the user (%)
12%



The most helpful NODEJS solutions

get user ipget user ipNODEJS

Click to see more ...

  5.2K     1.7K

how to get client netmask using node.js ?how to get client netmask using node.js ?NODEJS

Click to see more ...

  2.8K     557

How to get client machine name and computer name with node.js?How to get client machine name and computer name with node.js?NODEJS

Click to see more ...

  2.8K     423

how to get client local ip address using node.js ?how to get client local ip address using node.js ?NODEJS

Click to see more ...

  1.3K     311

How to get client ip address using node.jsHow to get client ip address using node.jsNODEJS

Click to see more ...

  1.1K     271

How to combine node.js and jquery ?How to combine node.js and jquery ?NODEJS

Click to see more ...

  1K     247

how to detect tablet, iPad, iPhone, Android and Blackberry using nodejs ?how to detect tablet, iPad, iPhone, Android and Blackberry using nodejs ?NODEJS

Click to see more ...

  1K     138

get real user ip address using node.js?get real user ip address using node.js?NODEJS

Click to see more ...

  461     124

how to update a record in mysql using node.js ?how to update a record in mysql using node.js ?NODEJS

Click to see more ...

  418     119

get client region using node.js ?get client region using node.js ?NODEJS

Click to see more ...

  370     118