Downloads a file from the private FOKUS repository and returns it as a raw vector or a character scalar, depending on as_chr
.
Usage
read_private_file(
path,
as_chr = FALSE,
use_cache = TRUE,
auth_token = pal::pkg_config_val("token_repo_private")
)
Arguments
- path
File path relative to the repository root.
- as_chr
Whether to return the file content as a character scalar, which is only recommended for text files. If
FALSE
, the file is returned as a raw vector instead.- use_cache
Whether or not to return cached results if possible. Caching is done based on file content hashing, so the file is only newly fetched if it actually changed since the last download. If
FALSE
, the file is always newly fetched.- auth_token
Personal access token of a gitlab.com account with access to the private FOKUS repository.
Value
The file content, as character scalar if as_chr
, otherwise as a raw vector.
Details
Files are downloaded via GitLab's RESTful API (v4). If use_cache = TRUE
(the default), a downloaded file is cached
on disk in this package's user-cache pins board and only newly fetched from the private FOKUS repository GitLab remote if is has changed
since being downloaded the last time. Caching saves a bit of time and (potentially) a lot of bandwidth.
See also
Other data import functions:
read_easyvote_municipalities()
,
read_online_participation_codes()
,
read_survey_data()
,
read_voting_register_data_extra()
,
read_voting_register_ids()
,
tidy_cols()
Other private FOKUS repository functions:
print_private_repo_structure()
,
url_repo_private()
,
write_private_file()