Skip to content

Find the folder of a global command (installed via npm or not)

License

Notifications You must be signed in to change notification settings

fregante/bin-dir

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

bin-dir

Find the folder of a global command (installed via npm or not)

This is essentially a cross-os command for which + realpath + dirname plus special support for npm modules.

"Special support" means that bin-dir eslint won't open the directory .../eslint/bin but .../eslint

Install

npm install --global bin-dir

CLI

$ bin-dir npm
/usr/local/lib/node_modules/npm

$ bin-dir wget
/usr/local/Cellar/wget/1.18/bin

$ bin-dir unicorns
// no output

API

const binDir = require('bin-dir');

binDir('xo') === '/usr/local/lib/node_modules/xo';
binDir('brew') === '/usr/local/bin';
binDir('unicorns') === undefined;

License

MIT © Federico Brigante

About

Find the folder of a global command (installed via npm or not)

Resources

License

Stars

Watchers

Forks

Packages

No packages published