Find Cache DirInstallation

Installation

How to install and import @visulima/find-cache-dir

Last updated:

Installation

Install the package using your preferred package manager:

npm install @visulima/find-cache-dir
pnpm add @visulima/find-cache-dir
yarn add @visulima/find-cache-dir
bun add @visulima/find-cache-dir

Import Methods

Import async and sync versions:

import { findCacheDir, findCacheDirSync } from "@visulima/find-cache-dir";

// Async
const cacheDir = await findCacheDir("my-app");

// Sync
const cacheDirSync = findCacheDirSync("my-app");

CommonJS

For CommonJS environments:

const { findCacheDir, findCacheDirSync } = require("@visulima/find-cache-dir");

const cacheDir = findCacheDir("my-app");

Requirements

  • Node.js: ≥22.13 ≤25.x
  • Filesystem access: Read/write permissions for cache directories
  • TypeScript: ≥5.0 (optional, for type definitions)

Verify Installation

Test the installation:

import { findCacheDir } from "@visulima/find-cache-dir";

const cacheDir = await findCacheDir("test-app");
console.log(`Cache directory: ${cacheDir}`);

You should see a path to your system's cache directory!

TypeScript Support

The package includes full TypeScript type definitions:

import { findCacheDir, findCacheDirSync } from "@visulima/find-cache-dir";
import type { Options } from "@visulima/find-cache-dir";

const options: Options = {
  cwd: process.cwd(),
  create: true,
  throwError: false
};

const cacheDir: string = await findCacheDir("my-app", options);

Next Steps

Support

Contribute to our work and keep us going

Community is the heart of open source. The success of our packages wouldn't be possible without the incredible contributions of users, testers, and developers who collaborate with us every day.Want to get involved? Here are some tips on how you can make a meaningful impact on our open source projects.

Ready to help us out?

Be sure to check out the package's contribution guidelines first. They'll walk you through the process on how to properly submit an issue or pull request to our repositories.

Submit a pull request

Found something to improve? Fork the repo, make your changes, and open a PR. We review every contribution and provide feedback to help you get merged.

Good first issues

Simple issues suited for people new to open source development, and often a good place to start working on a package.
View good first issues