
Check downloaded files against the file system
Source:R/archive-osf-helpers.R
dot-osf_verify_downloads.RdConfirms that every file the download planned to save is actually present,
and is the size the OSF reported. Called at the end of osf_file_download().
Arguments
- ret
the return table being built, with
pathanddownloadedcolumns- download_to
the absolute folder the project was saved in
- check_size
whether to compare each file's size on disk against the size the OSF reported. May be a single value, or one value per row: in zip mode with
unzip = FALSE, rows covered by an archive share one file on disk (so a per-file size comparison is meaningless for them), while rows fetched individually because no archive could hold them are real files whose size can and should be checked.
Details
A row can be marked as downloaded because the copy step ran for it, while
nothing usable ended up on disk: the transfer may have failed after retries,
file.copy() may have returned FALSE, the file system may have rejected the
name, or the write may have been truncated. Only the file system settles it.
Size is compared where the OSF reported one. A file present but a different size is counted as not downloaded, since a truncated file is worse than an absent one – it looks complete to everything downstream.