When creating file checksums via sha1 or similar, I would recommend setting raw=TRUE in the file connections. Maybe that can be added to the documentation?
Use case: comparing files on different machines. If the file is an RDS file (or binary or compressed?) and raw=FALSE (default), the file() function does something that leads to changes in the hash. It is also quicker to use raw=TRUE.
raw
logical. If true, a ‘raw’ interface is used which will be more suitable for arguments which are not regular files, e.g.character devices. This suppresses the check for a compressed file when opening for text-mode reading, and asserts that the ‘file’ may not be seekable.
When creating file checksums via sha1 or similar, I would recommend setting
raw=TRUE
in the file connections. Maybe that can be added to the documentation?Use case: comparing files on different machines. If the file is an RDS file (or binary or compressed?) and
raw=FALSE
(default), thefile()
function does something that leads to changes in the hash. It is also quicker to useraw=TRUE
.Example:
From the documentation of
file