app-cache-dir v0.4.0 resolves an application name to the standard cache directory path based on OS conventions: XDG_CACHE_HOME on POSIX, LOCALAPPDATA on Windows. Provides cross-platform cache paths (~/.cache/<app> on macOS/Linux, %LOCALAPPDATA%\<app>\cache on Windows). Includes .posix() and .win32() methods to force a specific platform layout. Falls back to os.tmpdir()/<app>/cache when environment variables are missing. Lightweight, no external dependencies, synchronous API. Last updated 2018, in maintenance mode.
npm install app-cache-dirNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic usage, cross-platform behavior, forcing a specific platform, and XDG_CACHE_HOME override.
Update any hardcoded Windows cache paths to include the \child directory if needed.
Consider alternatives like env-paths or xdg-basedir for more modern support.
Ensure HOME or XDG_CACHE_HOME is set in production environments to avoid unexpected tmpdir usage.
Run 'npm install app-cache-dir' and check the require statement: const appCacheDir = require('app-cache-dir');Use require('app-cache-dir') instead of import. If using ES modules, use createRequire or switch to a compatible package.Call the method on the default export: const posixPath = require('app-cache-dir').posix('app');No dependency data recorded yet.