Fil.Stat (Fil v0.1.0)

Copy Markdown View Source

Metadata about a file or directory.

A field is nil when the storage doesn't know it. Object stores have no directories to stat, and the local filesystem stores no content type.

  • :size: size in bytes (nil for directories on object stores)
  • :type: :regular or :directory
  • :mtime: last modification time as a DateTime in UTC
  • :etag: an opaque version tag. Fil.Adapter.Local derives a weak one ("size-mtime"); S3 returns the object's ETag
  • :content_type: the stored MIME type, when the storage keeps one
  • :checksum: {algorithm, checksum}, with the checksum base64 encoded the way S3 encodes it. Only filled in when Fil.stat/3 is called with the :checksum option

Summary

Types

t()

@type t() :: %Fil.Stat{
  checksum: {:sha256 | :sha1 | :crc32, String.t()} | nil,
  content_type: String.t() | nil,
  etag: String.t() | nil,
  mtime: DateTime.t() | nil,
  size: non_neg_integer() | nil,
  type: type() | nil
}

type()

@type type() :: :regular | :directory