find-cache-dir
- Version 5.0.0
- Published
- 7.23 kB
- 2 dependencies
- MIT license
Install
npm i find-cache-dir
yarn add find-cache-dir
pnpm add find-cache-dir
Overview
Finds the common standard cache directory
Index
Functions
Type Aliases
Functions
function findCacheDirectory
findCacheDirectory: (options: Options) => string | undefined;
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 totrue
,false
,1
or0
. If one is not found, it tries to find apackage.json
file, searching every parent directory of thecwd
specified (or implied from other options). It returns astring
containing the absolute path to the cache directory, orundefined
ifpackage.json
was never found or if thenode_modules
directory is unwritable.Example 1
import findCacheDirectory from 'find-cache-dir';findCacheDirectory({name: 'unicorns'});//=> '/user/path/node-modules/.cache/unicorns'
Type Aliases
type Options
type Options = { /** Should be the same as your project name in `package.json`. */ readonly name: 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. */ readonly files?: string[];
/** The directory to start searching for a `package.json` from.
@default process.cwd() */ readonly cwd?: string;
/** Create the directory synchronously before returning.
@default false */ readonly create?: boolean;};
Package Files (1)
Dependencies (2)
Dev Dependencies (5)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/find-cache-dir
.
- Markdown[](https://www.jsdocs.io/package/find-cache-dir)
- HTML<a href="https://www.jsdocs.io/package/find-cache-dir"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3019 ms. - Missing or incorrect documentation? Open an issue for this package.