username:获取当前用户的用户名

时间:2021-05-26 03:27:30
【文件属性】:
文件名称:username:获取当前用户的用户名
文件大小:6KB
文件格式:ZIP
更新时间:2021-05-26 03:27:30
JavaScript 用户名 获取当前用户的用户名 该模块仅用于提供信息,而不用于安全标识。 安装 $ npm install username 该软件包仅在Node.js中有效,而在浏览器中无效。 用法 const username = require ( 'username' ) ; ( async ( ) => { console . log ( await username ( ) ) ; //=> 'sindresorhus' } ) ( ) ; 原料药 它首先尝试从SUDO_USER LOGNAME USER LNAME USERNAME环境变量获取用户名。 然后回落到macOS / Linux上的$ id -un和Windows上的$ whoami ,在极少数情况下,没有设置任何环境变量。 结果被缓存。 用户名() 返回带有用户名的Promise 。 username.s
【文件预览】:
username-main
----index.js(2KB)
----test.js(260B)
----package.json(689B)
----index.test-d.ts(167B)
----readme.md(949B)
----.github()
--------funding.yml(91B)
--------workflows()
----license(1KB)
----test-userinfo.js(406B)
----test-fallback.js(386B)
----index.d.ts(1KB)
----.gitignore(23B)
----.npmrc(19B)
----.editorconfig(175B)
----.gitattributes(19B)

网友评论