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.
is-installed-globally
Advanced tools
Check if your package was installed globally
Weekly downloads
Package description
The `is-installed-globally` package is a simple utility that allows developers to check if a given npm package is installed globally on the system. This can be particularly useful for CLI tools or libraries that need to adjust their behavior based on whether they're running in a global context.
Check if a package is installed globally
This feature allows developers to programmatically determine if the current package is installed globally. It returns a boolean value: `true` if the package is installed globally, and `false` otherwise. This can be useful for CLI applications that may have different behaviors or configurations when installed globally versus locally.
const isInstalledGlobally = require('is-installed-globally');
console.log(isInstalledGlobally); // true or false
Similar to `is-installed-globally`, `global-dirs` provides information about where globally installed packages and their binaries are located. While `is-installed-globally` simply checks if the current package is installed globally, `global-dirs` gives more detailed information about the directories themselves, which can be useful for more in-depth system configuration or analysis.
The `global-modules` package is another tool that provides the path to the global `node_modules` directory. Unlike `is-installed-globally`, which checks if a specific package is installed globally, `global-modules` helps in finding the location of all globally installed modules. This can be particularly useful for scripts or tools that need to interact with or modify globally installed packages.
Readme
Check if your package was installed globally
Can be useful if your CLI needs different behavior when installed globally and locally.
npm install is-installed-globally
import isInstalledGlobally from 'is-installed-globally';
// With `npm install your-package`
console.log(isInstalledGlobally);
//=> false
// With `npm install --global your-package`
console.log(isInstalledGlobally);
//=> true
FAQs
Check if your package was installed globally
The npm package is-installed-globally receives a total of 8,772,329 weekly downloads. As such, is-installed-globally popularity was classified as popular.
We found that is-installed-globally demonstrated a healthy version release cadence and project activity because the last version was released less than 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.