Get the global cache directory (OS-specific) and ensure it exists. Current version 6.0.1, with a stable release cadence via npm. Key differentiators: returns a normalized path using the OS-standard cache location (macOS: ~/Library/Caches, Linux: ~/.cache, Windows: AppData\Local\Cache), auto-creates the directory if missing, and is fully typed with TypeScript definitions. ESM-only, requires Node.js >=18.18.0. Simpler than alternatives like node-cachedir by providing a one-function API with directory creation.
npm install global-cache-dirNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Gets and ensures the existence of the OS-specific global cache directory for 'myapp'.
Switch to import syntax and ensure Node.js >=18.18.0.
Await the function call.
Sanitize input to [a-zA-Z0-9-]+.
Upgrade to v5+ and use await.
Use import globalCacheDir from 'global-cache-dir' or downgrade to v4.x (but v4 is deprecated).
Use await globalCacheDir('myapp') or .then().Pass a valid name string.
Use only digits, letters, and dashes.
No dependency data recorded yet.