Skip to contents

Download a single file straight from the server. newgraph/hornby_2026 is 327 MB and its .qgs is 2.2 MB, so reading a project file out of a clone costs about 150x what the task needs.

Usage

rfp_mergin_file_get(project, file, path_out, version = NULL, overwrite = FALSE)

Arguments

project

Character. namespace/project.

file

Character. Path within the project, e.g. "hornby_2026.qgs".

path_out

Character. Local destination file (not a directory). Parent directories are created.

version

Character. "vN", or NULL (default) for HEAD.

overwrite

Logical. Replace path_out if it exists. Default FALSE - a fetched .qgs landing on top of a live project file is the expensive mistake this guards.

Value

Invisibly, path_out.

What is verified

The file's checksum, against what the server reported for that version - not just that something arrived. The download reads in chunks and treats a short read as end-of-file, so a truncated transfer produces a plausible-looking file rather than an error. Checking bytes on disk is the pattern this subsystem already uses in place of trusting an exit code (#60); the checksum is that, one step stronger, and it is free because the file listing already carries it.

Examples

if (FALSE) { # \dontrun{
rfp_mergin_file_get("newgraph/hornby_2026", "hornby_2026.qgs",
                    fs::path(tempdir(), "hornby.qgs"))
} # }