Give a file input an immutable content identity
Value
A path-like character vector with class tarshare_file. It can be
passed to ordinary file-reading functions. Its identity uses id, names,
and ordering, rather than physical paths.
Details
Supplying id asserts that the identifier describes the bytes used by the
computation. The caller owns verification when localizing or registering
those files. The cache does not repeat that verification. Explicit IDs may
also describe immutable directories; automatic hashing accepts regular files.
Relocation is safe only when the command depends on contents rather than
pathnames. Include any meaningful filename, sample label, or path-dependent
tool setting separately in the computation or its context.
Examples
path <- tempfile()
writeLines("1,2,3", path)
input <- shared_file(path)
readLines(input)
#> [1] "1,2,3"