Skip to contents

Deletes a specific user file using the appropriate backend plugin, based on the `ACCOUNT_BACKEND` environment variable. This function abstracts the file removal logic, allowing different storage systems to handle file deletion (e.g., local file system, MongoDB, Google Drive).

Usage

remove_user_file(user_id, file_name = "account_tree.Rds")

Arguments

user_id

A character string representing the user ID.

file_name

Name of the file to remove. Defaults to `"account_tree.Rds"`.

Value

Invisibly returns `NULL`. Issues a warning if the file does not exist, or throws an error if the backend plugin is not found.

Details

The actual removal behavior is implemented by the selected backend plugin (e.g., `remove_from_file`, `remove_from_gdrive`, etc.). Configuration is controlled via environment variables like `ACCOUNT_BACKEND` and `ACCOUNT_BASE_DIR`.

See also

[save_user_file()], [load_user_file()], [build_plugin_args()]

Examples

if (FALSE) { # \dontrun{
  remove_user_file("user123")  # Deletes "account_tree.Rds"
  remove_user_file("user123", file_name = "data.json")
} # }