@fujia/user-home
v1.1.1
Published
Obtain the user home directory and fallback to the system temp directory if don't exist.
Maintainers
Readme
Obtain the user home directory and fallback to the system temp directory if don't exist.
English | 简体中文
Installation
npm i @fujia/user-home
# or use yarn
yarn add @fujia/user-homeUsage
You can import the generated bundle to use the whole library generated by this starter:
import userHome from '@fujia/user-home'
console.log(await userHome()); // => '/Users/sunny'
// And if there is no home directory:
console.log(await userHome()); // => undefined, and log info: 'Doesn\'t exist home directory for current login user.'
// also, you can get the temp directory by pass true param
console.log(await userHome(true)); // => something look like(mac): /var/folders/70/x0nk_t0s2m93xbzq4x7px0t40000gn/T
