View Source FileStore.Stat (file_store v0.4.0)
A struct that holds file information.
Fields
key- The unique identifier for the file.etag- A fingerprint for the contents of a file. This is almost always an MD5 checksum.size- The byte size of the file.type- The content-type of the file.
Link to this section Summary
Link to this section Types
Specs
t() :: %FileStore.Stat{
etag: binary(),
key: binary(),
size: non_neg_integer(),
type: binary()
}
Link to this section Functions
Specs
Compute an MD5 checksum.
Example
iex> FileStore.Stat.checksum("hello world")
"5eb63bbbe01eeed093cb22bb8f5acdc3"
Specs
checksum_file(Path.t()) :: {:ok, binary()} | {:error, File.posix()}
Compute the MD5 checksum of a file on disk.
Example
iex> FileStore.Stat.checksum_file("test/fixtures/test.txt")
{:ok, "0d599f0ec05c3bda8c3b8a68c32a1b47"}
iex> FileStore.Stat.checksum_file("test/fixtures/missing.txt")
{:error, :enoent}