cache_dir: Get or create the cache directory path

View source: R/cache.R

cache_dirR Documentation

Get or create the cache directory path

Description

Returns the path where shinyelectron stores downloaded runtimes (R, Python, Node.js) and other cached assets. By default, the directory is created if it doesn't already exist. Pass create = FALSE to query the path without side effects.

Usage

cache_dir(create = TRUE)

Arguments

create

Logical. Whether to create the directory if it doesn't exist. Default is TRUE.

Value

Character string. Absolute path to the cache directory, typically ⁠~/.cache/shinyelectron/assets⁠ on Linux, ⁠~/Library/Caches/shinyelectron/assets⁠ on macOS, or ⁠\%LOCALAPPDATA\%/shinyelectron/shinyelectron/Cache/assets⁠ on Windows.

Cache Layout

Cached runtimes are organized by type, platform, architecture, and version:

assets/
|-- r/
|   |-- win/x64/4.5.3/
|   |-- mac/arm64/4.5.3/
|-- python/
|   |-- win/x64/3.14.6/
|   |-- mac/arm64/3.14.6/
|-- nodejs/
|   |-- v22.11.0/darwin-arm64/
|   |-- v22.11.0/win-x64/

Use cache_info() to see what's actually installed with disk usage.

See Also

cache_info() to see what's cached, cache_clear() to remove cached assets, cache_remove() to remove a specific version.

Examples

# Query the cache path without creating it
cache_dir(create = FALSE)

# Get or create the cache directory (writes to the user cache dir)
if (interactive()) {
  cache_dir()
}


shinyelectron documentation built on Dec. 3, 2026, 9:07 a.m.