OpenrelikWorkerCommon.FileUtils.OutputFile (openrelik_worker_common v0.1.0)

Copy Markdown View Source

Represents an output file created by an OpenRelik worker task (Elixir port of openrelik_worker_common.file_utils.OutputFile).

Fields

  • :uuid - Unique identifier (uuid4 hex) for the file.
  • :display_name - Display name for the file.
  • :extension - Extension of the file.
  • :data_type - Data type of the file.
  • :path - The full path to the file on disk.
  • :original_path - The full original path to the file.
  • :source_file_id - The source file ID or parent OutputFile this file belongs to.
  • :register_in_db - When false, the mediator skips DB registration, hashing, and file reports for this file. Defaults to true.

Summary

Functions

Initializes an %OutputFile{} struct.

Returns a dictionary (string-keyed map) representation of the OutputFile struct. This is what the mediator server receives and uses to create a File in the database.

Types

t()

@type t() :: %OpenrelikWorkerCommon.FileUtils.OutputFile{
  data_type: String.t() | nil,
  display_name: String.t(),
  extension: String.t() | nil,
  original_path: String.t() | nil,
  path: String.t(),
  register_in_db: boolean(),
  source_file_id: integer() | String.t() | t() | map() | nil,
  uuid: String.t()
}

Functions

new(attrs)

@spec new(keyword() | map()) :: t()

Initializes an %OutputFile{} struct.

Accepts keyword options or a map, or positional arguments matching Python's OutputFile(uuid, output_path, display_name, ...).

new(uuid, output_path, display_name, opts \\ [])

@spec new(String.t(), String.t(), String.t(), keyword() | map()) :: t()

to_dict(file)

@spec to_dict(t()) :: %{required(String.t()) => term()}

Returns a dictionary (string-keyed map) representation of the OutputFile struct. This is what the mediator server receives and uses to create a File in the database.