Returns the path to the user's cache directory.
In v1.1.2(2020.06.26), Deno Remove
Deno.dir
and dirs dependency #6385
The returned value depends on the operating system and is either a string,
containing a value from the following table, or null
.
Platform | Value | Example |
---|---|---|
Linux | $XDG_CACHE_HOME or $HOME /.cache |
/home/justjavac/.cache |
macOS | $HOME /Library/Caches |
/Users/justjavac/Library/Caches |
Windows | $LOCALAPPDATA |
C:\Users\justjavac\AppData\Local |
Requires allow-env
permission.
Returns null
if there is no applicable directory or if any other error occurs.
import cacheDir from "https://deno.land/x/cache_dir/mod.ts";
cacheDir();
// Lin: "/home/justjavac/.cache"
// Mac: "/Users/justjavac/Library/Caches"
// Win: "C:\Users\justjavac\AppData\Local"
deno_cache_dir is released under the MIT License. See the bundled LICENSE file for details.