user-home

WebJar for user-home

License

License

MIT
GroupId

GroupId

org.webjars.npm
ArtifactId

ArtifactId

user-home
Last Version

Last Version

2.0.0
Release Date

Release Date

Type

Type

jar
Description

Description

user-home
WebJar for user-home
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/sindresorhus/user-home

Download user-home

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.npm/user-home/ -->
<dependency>
    <groupId>org.webjars.npm</groupId>
    <artifactId>user-home</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.npm/user-home/
implementation 'org.webjars.npm:user-home:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.npm/user-home/
implementation ("org.webjars.npm:user-home:2.0.0")
'org.webjars.npm:user-home:jar:2.0.0'
<dependency org="org.webjars.npm" name="user-home" rev="2.0.0">
  <artifact name="user-home" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.npm', module='user-home', version='2.0.0')
)
libraryDependencies += "org.webjars.npm" % "user-home" % "2.0.0"
[org.webjars.npm/user-home "2.0.0"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.npm : os-homedir jar [1.0.0,2)

Project Modules

There are no modules declared in this project.

user-home

Get the path to the user home directory

Install

$ npm install user-home

Usage

const userHome = require('user-home');

console.log(userHome);
//=> '/Users/sindresorhus'

Returns null in the unlikely scenario that the home directory can't be found.

FAQ

Why not just use the os-home module?

This module was made long before os-homedir. When Node.js decided to add a native method for getting the user's home directory, I made a polyfill matching its API and decided to depend on it here, so not to have duplicate code. The main reason this one is still around is that lots of modules depend on it and I see no reason to inconvenience dependents by deprecating this. This one also gets the home directory on startup and returns a string rather than exposing a method, so it's faster, and I prefer this API. Modules are cheap in Node.js, so doesn't matter. Use whichever you prefer. I'm going to continue using this one.

Related

  • user-home-cli - CLI for this module
  • home-or-tmp - Get the user home directory with fallback to the system temp directory

Get professional support for this package with a Tidelift subscription
Tidelift helps make open source sustainable for maintainers while giving companies
assurances about security, maintenance, and licensing for their dependencies.

Versions

Version
2.0.0
1.1.1