Skip to contents

Get the unique file extension(s) of the target data file(s) in target_path. If target_path is a directory, the function will return the unique file extensions of all files in the directory. If target_path is a file, the function will return the file extension of that file.

Usage

get_target_file_ext(hub_path = NULL, target_path)

Arguments

hub_path

If not NULL, must be a SubTreeFileSystem class object of the root to a cloud hosted hub. Required to trigger the SubTreeFileSystem method.

target_path

character string. The path to the target data file or directory. Usually the output of get_target_path().

Examples

hub_path <- withr::local_tempdir()
example_hub <- "https://github.com/hubverse-org/example-complex-forecast-hub.git"
gert::git_clone(url = example_hub, path = hub_path)
target_path <- get_target_path(hub_path, "time-series")
get_target_file_ext(hub_path, target_path)
#> [1] "csv"