npm-cli-dir
v4.0.0
Published
Resolve the directory path where npm CLI is installed
Downloads
1,793
Maintainers
Readme
npm-cli-dir
A Node.js module to resolve a path of the directory where npm CLI is installed
const npmCliDir = require('npm-cli-dir');
(async () => {
const dir = await npmCliDir(); //=> '/usr/local/lib/node_modules/npm'
})();
Installation
npm install npm-cli-dir
API
const npmCliDir = require('npm-cli-dir');
npmCliDir()
Return: Promise<string>
const {readdir} = require('fs').promises;
const npmCliDir = require('npm-cli-dir');
(async () => {
await readdir(await npmCliDir());
//=> ['.mailmap', '.npmignore', '.travis.yml', 'AUTHORS', 'CHANGELOG.md', ...]
})();
License
ISC License © 2017 - 2019 Watanabe Shinnosuke