A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/avajs/find-cache-dir below:

sindresorhus/find-cache-directory: Finds the common standard cache directory

Finds the common standard cache directory

The nyc and AVA projects decided to standardize on a common directory structure for storing cache information:

# nyc
./node_modules/.cache/nyc

# ava
./node_modules/.cache/ava

# your-module
./node_modules/.cache/your-module

This module makes it easy to correctly locate the cache directory according to this shared spec. If this pattern becomes ubiquitous, clearing the cache for multiple dependencies becomes easy and consistent:

rm -rf ./node_modules/.cache
npm install find-cache-directory
import findCacheDirectory from 'find-cache-directory';

findCacheDirectory({name: 'unicorns'});
//=> '/user/path/node-modules/.cache/unicorns'
findCacheDirectory(options?)

Finds the cache directory using the given options.

The algorithm checks for the CACHE_DIR environmental variable and uses it if it is not set to true, false, 1 or 0. If one is not found, it tries to find a package.json file, searching every parent directory of the cwd specified (or implied from other options). It returns a string containing the absolute path to the cache directory, or undefined if package.json was never found or if the node_modules directory is unwritable.

Type: object

Required
Type: string

Should be the same as your project name in package.json.

Type: string[]

An array of files that will be searched for a common parent directory. This common parent directory will be used in lieu of the cwd option below.

Type: string
Default process.cwd()

The directory to start searching for a package.json from.

Type: boolean
Default false

Create the directory synchronously before returning.


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4