# cache-directory

> Find the proper cache directory based on operating system

Latest version **2.0.0** (published 2018-03-01) · LGPL-3.0+ license · 0 weekly downloads

## Install

```sh
npm install cache-directory
pnpm add cache-directory
yarn add cache-directory
bun add cache-directory
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.0.0 |
| Published | 2018-03-01 |
| First published | 2016-07-22 |
| Weekly downloads | 0 |
| License | LGPL-3.0+ |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=4 |
| Dependencies | 1 |
| Unpacked size | 45.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Alex Jordan |
| Maintainers | strugee |
| Keywords | cache, xdg, directory |

## Links

- npm: https://www.npmjs.com/package/cache-directory
- Repository: https://github.com/strugee/node-cache-directory
- Homepage: https://github.com/strugee/node-cache-directory#readme
- Issues: https://github.com/strugee/node-cache-directory/issues
- npm.io page: https://npm.io/package/cache-directory

## Dependencies (1)

- [xdg-basedir](https://npm.io/package/xdg-basedir.md) ^3.0.0

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 2.0.0 (latest) — 2018-03-01
- 1.1.0 — 2016-07-24
- 1.0.0 — 2016-07-22

## README

# `cache-directory`

Find the proper cache directory based on operating system

## Installation

    npm install cache-directory

## Usage

`cache-directory` takes one argument, the app name.

```js
var cacheDir = require('cache-directory');

console.log(cacheDir('myApp'));
```

## Caveats

When run on OS X, `cache-directory` assumes it isn't run in a sandboxed process environment. If it is, it will probably break. Additionally, the app name is used instead of the [conventional][1] bundle identifier (for simplicity and because many `cache-directory` consumers won't necessarily _have_ a bundle identifier).

If a suitable cache directory can't be found, `cache-directory` will return `null`. You need to handle this case. A reasonable course of action would be to use a temp directory, for which you can use the [`cache-or-tmp-directory`][2] module.

## License

LGPL 3.0+

## Author

Alex Jordan <alex@strugee.net>

 [1]: https://developer.apple.com/library/prerelease/content/documentation/FileManagement/Conceptual/FileSystemProgrammingGuide/MacOSXDirectories/MacOSXDirectories.html#//apple_ref/doc/uid/TP40010672-CH10-SW1
 [2]: https://npmjs.com/package/cache-or-tmp-directory

---
_Source: https://npm.io/package/cache-directory · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
