R/zzz.R

Defines functions .onAttach .onLoad

.onLoad <- function(libname, pkgname) {
  gutenberg_cache_set(verbose = FALSE)
  gutenberg_ensure_cache_dir()
}

.onAttach <- function(libname, pkgname) {
  if (!interactive()) {
    return(invisible())
  }

  path <- gutenberg_cache_dir()
  type <- getOption("gutenbergr_cache_type", "session")
  type_str <- if (type == "session") {
    "session (temporary)"
  } else {
    "persistent"
  }
  packageStartupMessage(
    "gutenbergr: using ",
    type_str,
    " cache\n",
    "  cache directory: ",
    path
  )
  invisible()
}

Try the gutenbergr package in your browser

Any scripts or data that you put into this service are public.

gutenbergr documentation built on Jan. 19, 2026, 9:07 a.m.