Debkit.Tar.Entry (Debkit v0.2.0)

Copy Markdown View Source

A single tar entry: a regular file or a directory.

The same struct is produced by Debkit.Tar.read/1 and accepted by Debkit.Tar.write/1, so an archive round-trips through it. Build entries with the Debkit.Tar.file/3 and Debkit.Tar.dir/2 constructors, or directly:

%Debkit.Tar.Entry{name: "./control", contents: "Package: hello\n"}

Fields

  • :name — the entry path, stored verbatim (keep a leading ./ and, for a directory, the trailing /). Required.
  • :contents — the file body; always "" for a directory.
  • :mode — the permission bits. nil means "default for the type" — 0o644 for a file, 0o755 for a directory — resolved by Debkit.Tar.write/1.
  • :type:file or :dir.

Summary

Types

t()

A tar entry's type.

Types

t()

@type t() :: %Debkit.Tar.Entry{
  contents: binary(),
  mode: non_neg_integer() | nil,
  name: String.t(),
  type: type()
}

type()

@type type() :: :file | :dir

A tar entry's type.