Socket
Socket
Sign inDemoInstall

@types/find-cache-dir

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @types/find-cache-dir

TypeScript definitions for find-cache-dir


Version published
Weekly downloads
3M
decreased by-0.81%
Maintainers
1
Install size
7.72 kB
Created
Weekly downloads
 

Package description

What is @types/find-cache-dir?

The @types/find-cache-dir package provides TypeScript type definitions for the find-cache-dir library, which is a utility that helps you find a cache directory based on the npm package name. This is particularly useful in development environments where caching of output can significantly speed up build processes. The type definitions ensure that TypeScript users can integrate find-cache-dir into their projects with type safety.

What are @types/find-cache-dir's main functionalities?

Type Definitions for Cache Directory Finding

This code demonstrates how to use find-cache-dir with TypeScript to find or create a cache directory specific to an application named 'my-app'. The @types/find-cache-dir package provides the necessary type definitions to ensure type safety and autocompletion in TypeScript environments.

import findCacheDir from 'find-cache-dir';

const cacheDir = findCacheDir({ name: 'my-app' });
console.log(cacheDir);

Other packages similar to @types/find-cache-dir

Readme

Source

Installation

npm install --save @types/find-cache-dir

Summary

This package contains type definitions for find-cache-dir (https://github.com/avajs/find-cache-dir#readme).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/find-cache-dir.

index.d.ts

// Type definitions for find-cache-dir 3.2
// Project: https://github.com/avajs/find-cache-dir#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
//                 Piotr Błażejewicz <https://github.com/peterblazejewicz>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

export = findCacheDir;

/**
 * Finds the cache directory using the supplied options.
 * The algorithm 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.
 */
declare function findCacheDir(options: findCacheDir.OptionsWithThunk): ((...pathParts: string[]) => string) | undefined;
declare function findCacheDir(options: findCacheDir.Options): string | undefined;

declare namespace findCacheDir {
    interface Options {
        /**
         * Should be the same as your project name in `package.json`.
         */
        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.
         */
        files?: string | string[] | undefined;

        /**
         * Directory to start searching for a `package.json` from.
         */
        cwd?: string | undefined;

        /**
         * If `true`, the directory will be created synchronously before returning.
         * @default false
         */
        create?: boolean | undefined;

        /**
         * If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`.
         * @default false
         */
        thunk?: boolean | undefined;
    }

    interface OptionsWithThunk extends Options {
        /**
         * If `true`, this modifies the return type to be a function that is a thunk for `path.join(theFoundCacheDirectory)`.
         * @default false
         */
        thunk: true;
    }
}

Additional Details

  • Last updated: Tue, 06 Jul 2021 20:32:58 GMT
  • Dependencies: none
  • Global values: none

Credits

These definitions were written by BendingBender, and Piotr Błażejewicz.

FAQs

Last updated on 06 Jul 2021

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc