Kreuzberg.ArchiveEntry (kreuzberg v4.9.5)

Copy Markdown View Source

Structure representing an entry extracted from an archive file.

Matches the Rust ArchiveEntry struct.

Fields

  • :path - The path of the entry within the archive
  • :mime_type - The MIME type of the entry content
  • :result - The extraction result for this entry

Summary

Functions

Creates an ArchiveEntry struct from a map.

Converts an ArchiveEntry struct to a map.

Types

t()

@type t() :: %Kreuzberg.ArchiveEntry{
  mime_type: String.t(),
  path: String.t(),
  result: map() | nil
}

Functions

from_map(data)

@spec from_map(map()) :: t()

Creates an ArchiveEntry struct from a map.

Examples

iex> Kreuzberg.ArchiveEntry.from_map(%{
...>   "path" => "document.pdf",
...>   "mime_type" => "application/pdf",
...>   "result" => %{"content" => "text"}
...> })
%Kreuzberg.ArchiveEntry{
  path: "document.pdf",
  mime_type: "application/pdf",
  result: %{"content" => "text"}
}

to_map(entry)

@spec to_map(t()) :: map()

Converts an ArchiveEntry struct to a map.

Examples

iex> entry = %Kreuzberg.ArchiveEntry{path: "doc.pdf", mime_type: "application/pdf"}
iex> Kreuzberg.ArchiveEntry.to_map(entry)
%{
  "path" => "doc.pdf",
  "mime_type" => "application/pdf",
  "result" => nil
}