@fujia/user-home
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published
hammer logo

@fujia/user-home

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-home

Usage

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 

/@fujia/user-home/

    Package Sidebar

    Install

    npm i @fujia/user-home

    Weekly Downloads

    1

    Version

    1.1.1

    License

    MIT

    Unpacked Size

    10.5 kB

    Total Files

    7

    Last publish

    Collaborators

    • sunnyfu