Security News
New Proposed CISA Mandate Would Require Critical Infrastructure to Report Ransom Payments Within 24 Hours
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
home-or-tmp
Advanced tools
Get the user home directory with fallback to the system temp directory
Weekly downloads
Package description
The home-or-tmp npm package is a simple utility that provides a way to get the user's home directory or, if that's not available, a temporary directory. It is useful for applications that need to store or manage files in a user-specific or temporary location without having to worry about platform differences.
Get user's home directory or temporary directory
This feature allows you to retrieve a path to the user's home directory or a fallback temporary directory. It abstracts away the differences between operating systems and the availability of environment variables.
const homeOrTmp = require('home-or-tmp');
console.log(homeOrTmp); // Outputs the user's home directory or a temporary directory if the home directory is not available.
This package provides a way to get the user's home directory. It is similar to home-or-tmp but does not provide a fallback to a temporary directory if the home directory is not available.
Similar to os-homedir, user-home returns the path to the user's home directory. It does not offer a temporary directory fallback and is therefore less flexible than home-or-tmp when the home directory cannot be determined.
This package is used to find a temporary directory, which can be used as a fallback when the home directory is not accessible. It complements the functionality of home-or-tmp by focusing on temporary directory retrieval.
temp-dir is a simple package that provides the path to the system's temporary directory. It is similar to the temporary directory retrieval aspect of home-or-tmp but does not consider the user's home directory.
Readme
Get the user home directory with fallback to the system temp directory
Useful in cases where the home directory either isn't set or doesn't exist.
$ npm install home-or-tmp
import homeOrTemp from 'home-or-tmp';
console.log(homeOrTemp);
//=> '/Users/sindresorhus'
// And if there is no home directory:
console.log(homeOrTemp);
//=> '/var/folders/m3/5574nnhn0yj488ccryqr7tc80000gn/T'
FAQs
Get the user home directory with fallback to the system temp directory
The npm package home-or-tmp receives a total of 1,394,096 weekly downloads. As such, home-or-tmp popularity was classified as popular.
We found that home-or-tmp demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA has proposed a set of new rules that would require critical infrastructure to report cyber incidents and ransom payments.
Security News
Redis is no longer OSS, breaking its explicit commitment to remain under the BSD 3-Clause License forever. This has angered contributors who are now working to fork the software.
Product
Socket AI now enables 'AI detected potential malware' alerts by default, ensuring users benefit from AI-powered state-of-the-art malware detection without needing to opt-in.