A lightweight utility (v2.0.0, last updated ~2017) to determine the correct OS-specific cache directory (XDG on Linux, ~/Library/Caches on macOS, LocalAppData on Windows). Minimal API with one synchronous function. Unlike xdg-based-cache or find-cache-dir, this module has no dependencies and works on older Node.js (>=4). Released under LGPL 3.0+.
npm install cache-directoryNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to get the OS-specific cache directory for an app name and handle the null case.
Check for null and use a temp directory (e.g., os.tmpdir()) as fallback.
Use process.env.HOME or other sandbox-aware method for sandboxed apps.
Pass the bundle identifier as the app name if stricter adherence to Apple conventions is needed.
Run 'npm install cache-directory' and ensure the import path is correct.
Use 'const cacheDirectory = require('cache-directory');' or import default.No dependency data recorded yet.