Creates a lazy handle that references an OpenNeuro dataset without triggering an immediate download. The handle can be fetched later when the data is actually needed.
Arguments
- dataset_id
Dataset identifier (e.g., "ds000001").
- tag
Snapshot version tag. If NULL, uses latest snapshot when fetched.
- files
Character vector of specific files to download when fetched, or a regex pattern. If NULL, downloads all files when fetched.
- backend
Backend to use when fetching: "datalad", "s3", or "https". If NULL, auto-selects best available backend.
Details
Handles support a lazy evaluation pattern:
Create handle with
on_handle()- no download occursFetch data with
on_fetch()- download happens hereGet path with
on_path()- returns filesystem path
This is useful for pipelines where dataset references need to be defined early but data should only be downloaded when needed.
Important
S3 objects have copy semantics. You must capture the return value
of on_fetch():
See also
on_fetch() to materialize the download, on_path() to get path.
Examples
if (FALSE) { # \dontrun{
# Create lazy handle - no download yet
handle <- on_handle("ds000001", files = "participants.tsv")
print(handle) # Shows state: pending
# Fetch when data is needed
handle <- on_fetch(handle)
print(handle) # Shows state: ready
# Get filesystem path
path <- on_path(handle)
} # }