View on StackOverflow ..
Definitely, the easiest way to do it is using username
username
$ npm install username
const username = require('username'); (async () => { console.log(await username()); //=> 'current_username' })();