UNPKG

2.84 kBMarkdownView Raw
1# Installation
2> `npm install --save @types/find-cache-dir`
3
4# Summary
5This package contains type definitions for find-cache-dir (https://github.com/avajs/find-cache-dir#readme).
6
7# Details
8Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/find-cache-dir.
9## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/find-cache-dir/index.d.ts)
10````ts
11// Type definitions for find-cache-dir 3.2
12// Project: https://github.com/avajs/find-cache-dir#readme
13// Definitions by: BendingBender <https://github.com/BendingBender>
14// Piotr Błażejewicz <https://github.com/peterblazejewicz>
15// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
16
17export = findCacheDir;
18
19/**
20 * Finds the cache directory using the supplied options.
21 * The algorithm tries to find a `package.json` file, searching every parent directory of the `cwd` specified
22 * (or implied from other options). It returns a `string` containing the absolute path to the cache directory,
23 * or `undefined` if `package.json` was never found or if the `node_modules` directory is unwritable.
24 */
25declare function findCacheDir(options: findCacheDir.OptionsWithThunk): ((...pathParts: string[]) => string) | undefined;
26declare function findCacheDir(options: findCacheDir.Options): string | undefined;
27
28declare namespace findCacheDir {
29 interface Options {
30 /**
31 * Should be the same as your project name in `package.json`.
32 */
33 name: string;
34
35 /**
36 * An array of files that will be searched for a common parent directory.
37 * This common parent directory will be used in lieu of the `cwd` option below.
38 */
39 files?: string | string[] | undefined;
40
41 /**
42 * Directory to start searching for a `package.json` from.
43 */
44 cwd?: string | undefined;
45
46 /**
47 * If `true`, the directory will be created synchronously before returning.
48 * @default false
49 */
50 create?: boolean | undefined;
51
52 /**
53 * If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`.
54 * @default false
55 */
56 thunk?: boolean | undefined;
57 }
58
59 interface OptionsWithThunk extends Options {
60 /**
61 * If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`.
62 * @default false
63 */
64 thunk: true;
65 }
66}
67
68````
69
70### Additional Details
71 * Last updated: Tue, 06 Jul 2021 20:32:58 GMT
72 * Dependencies: none
73 * Global values: none
74
75# Credits
76These definitions were written by [BendingBender](https://github.com/BendingBender), and [Piotr Błażejewicz](https://github.com/peterblazejewicz).
77
\No newline at end of file