Description Usage Arguments Details Value Examples
View source: R/drop_content_hash.R
Compute a "content hash" using the same algorithm as dropbox. This
can be used to verify the content against the content_hash
field returned in drop_dir
.
1 |
file |
A vector of filenames |
Dropbox returns a hash of file contents in drop_dir
.
However, this is not a straightforward file hash. Instead the file
is divided into 4MB chunks, each of those is hashed and then the
concatenation of the hashes is itself hashed (see
this
page in the dropbox developer documentation for the details).
It's entirely unclear why it does not compute a hash of the file
itself, but here we are.
A character vector the same length as file
. Each
element is 64 character string which is the unique hash. Two
files that have the same hash have the same contents. Compare
this hash of a local file with the content_hash
field from
drop_dir
to see if you have the same file as
dropbox.
1 2 3 4 5 6 7 8 9 10 | ## Not run:
write.csv(mtcars, file = "mtt.csv")
drop_upload("mtt.csv")
files <- drop_dir()
# Dropbox's reported hash
files$content_hash[files$name == "mtt.csv"]
# Our computed hash:
drop_content_hash("mtt.csv")
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.