You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Drift/server/node_modules/global-dirs
Max Leiter 208ba42c0e
Initial commit
3 years ago
..
index.d.ts Initial commit 3 years ago
index.js Initial commit 3 years ago
license Initial commit 3 years ago
package.json Initial commit 3 years ago
readme.md Initial commit 3 years ago

readme.md

global-dirs

Get the directory of globally installed packages and binaries

Uses the same resolution logic as npm and yarn.

Install

$ npm install global-dirs

Usage

const globalDirectories = require('global-dirs');

console.log(globalDirectories.npm.prefix);
//=> '/usr/local'

console.log(globalDirectories.npm.packages);
//=> '/usr/local/lib/node_modules'

console.log(globalDirectories.npm.binaries);
//=> '/usr/local/bin'

console.log(globalDirectories.yarn.packages);
//=> '/Users/sindresorhus/.config/yarn/global/node_modules'

API

globalDirectories

npm

yarn

packages

Directory with globally installed packages.

Equivalent to npm root --global.

binaries

Directory with globally installed binaries.

Equivalent to npm bin --global.

prefix

Directory with directories for packages and binaries. You probably want either of the above.

Equivalent to npm prefix --global.


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.