Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shinnn/npm-cache-path
Get the path of npm cache folder
https://github.com/shinnn/npm-cache-path
cache directory javascript nodejs npm
Last synced: 27 days ago
JSON representation
Get the path of npm cache folder
- Host: GitHub
- URL: https://github.com/shinnn/npm-cache-path
- Owner: shinnn
- License: isc
- Created: 2017-04-20T09:06:33.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-10-17T02:23:17.000Z (about 6 years ago)
- Last Synced: 2024-09-15T19:37:54.374Z (about 2 months ago)
- Topics: cache, directory, javascript, nodejs, npm
- Language: JavaScript
- Homepage: https://docs.npmjs.com/cli/cache
- Size: 146 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# npm-cache-path
[![npm version](https://img.shields.io/npm/v/npm-cache-path.svg)](https://www.npmjs.com/package/npm-cache-path)
[![Build Status](https://travis-ci.org/shinnn/npm-cache-path.svg?branch=master)](https://travis-ci.org/shinnn/npm-cache-path)
[![Coverage Status](https://img.shields.io/coveralls/shinnn/npm-cache-path.svg)](https://coveralls.io/github/shinnn/npm-cache-path?branch=master)Get the path of [npm cache folder](https://docs.npmjs.com/cli/cache)
```javascript
const npmCachePath = require('npm-cache-path');(async () => {
await npmCachePath(); //=> '/Users/shinnn/.npm'
})();
```## Installation
[Use](https://docs.npmjs.com/cli/install) [npm](https://docs.npmjs.com/getting-started/what-is-npm).
```
npm install npm-cache-path
```## API
```javascript
const npmCachePath = require('npm-cache-path');
```### npmCachePath()
Return: `Promise`
It tries to get the path of [npm](https://docs.npmjs.com/getting-started/what-is-npm) cache folder, first [from the environment variables](https://github.com/shinnn/npm-cache-env), second from the stdout of [`npm config get cache`](https://docs.npmjs.com/cli/config#get) command.
```javascript
// npm_config_cache=/foo/bar node ./example.js(async () => {
await npmCachePath(); //=> '/foo/bar'
})();
```## License
[ISC License](./LICENSE) © 2018 Shinnosuke Watanabe