Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/npm-cli-dir
Resolve a path of the directory where npm CLI is installed
https://github.com/shinnn/npm-cli-dir
async cli directory javascript nodejs npm pathfinding promise realpath
Last synced: 26 days ago
JSON representation
Resolve a path of the directory where npm CLI is installed
- Host: GitHub
- URL: https://github.com/shinnn/npm-cli-dir
- Owner: shinnn
- License: isc
- Created: 2015-12-01T15:04:25.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2019-06-04T00:24:33.000Z (over 5 years ago)
- Last Synced: 2024-09-19T20:11:14.219Z (about 2 months ago)
- Topics: async, cli, directory, javascript, nodejs, npm, pathfinding, promise, realpath
- Language: JavaScript
- Homepage:
- Size: 113 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npm-cli-dir
[![npm version](https://img.shields.io/npm/v/npm-cli-dir.svg)](https://www.npmjs.com/package/npm-cli-dir)
[![Build Status](https://travis-ci.com/shinnn/npm-cli-dir.svg?branch=master)](https://travis-ci.com/shinnn/npm-cli-dir)
[![codecov](https://codecov.io/gh/shinnn/npm-cli-dir/branch/master/graph/badge.svg)](https://codecov.io/gh/shinnn/npm-cli-dir)A [Node.js](https://nodejs.org/) module to resolve a path of the directory where [npm CLI](https://github.com/npm/cli) is installed
```javascript
const npmCliDir = require('npm-cli-dir');(async () => {
const dir = await npmCliDir(); //=> '/usr/local/lib/node_modules/npm'
})();
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/about-npm/).
```
npm install npm-cli-dir
```## API
```javascript
const npmCliDir = require('npm-cli-dir');
```### npmCliDir()
Return: `Promise`
```javascript
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](./LICENSE) © 2017 - 2019 Watanabe Shinnosuke