Streams the file in blocks, so memory use does not grow with the file.
The SHA-256 counterpart is sha256_file().
Examples
p <- tempfile()
writeLines("capsule payload", p)
sha512_file(p)
#> [1] "5d0664a30f586585aca8896c34269ca62f2eba708d5d7983a80925d50eaee5535116f104f245649f33054880810b4f88c542d70fd86ba95111f80342fa9bf9ba"
crc32_file(p)
#> [1] 2211766739
# The block size is a speed knob and cannot change the digest.
identical(sha512_file(p, 16), sha512_file(p, 1048576))
#> [1] TRUE
unlink(p)