Dagger.File (dagger v0.19.4)

View Source

A file.

Summary

Functions

Change the owner of the file recursively.

Retrieves the contents of the file.

Return the file's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.

Writes the file to a file path on the host.

A unique identifier for this File.

Retrieves the name of the file.

Searches for content matching the given regular expression or literal string.

Retrieves the size of the file, in bytes.

Force evaluation in the engine.

Retrieves this file with its name set to the given name.

Retrieves the file with content replaced with the given text.

Retrieves this file with its created/modified timestamps set to the given time.

Types

t()

@type t() :: %Dagger.File{client: term(), query_builder: term()}

Functions

as_env_file(file, optional_args \\ [])

@spec as_env_file(t(), [{:expand, boolean() | nil}]) :: Dagger.EnvFile.t()

Parse as an env file

chown(file, owner)

@spec chown(t(), String.t()) :: t()

Change the owner of the file recursively.

contents(file, optional_args \\ [])

@spec contents(t(), offset_lines: integer() | nil, limit_lines: integer() | nil) ::
  {:ok, String.t()} | {:error, term()}

Retrieves the contents of the file.

digest(file, optional_args \\ [])

@spec digest(t(), [{:exclude_metadata, boolean() | nil}]) ::
  {:ok, String.t()} | {:error, term()}

Return the file's digest. The format of the digest is not guaranteed to be stable between releases of Dagger. It is guaranteed to be stable between invocations of the same Dagger engine.

export(file, path, optional_args \\ [])

@spec export(t(), String.t(), [{:allow_parent_dir_path, boolean() | nil}]) ::
  {:ok, String.t()} | {:error, term()}

Writes the file to a file path on the host.

id(file)

@spec id(t()) :: {:ok, Dagger.FileID.t()} | {:error, term()}

A unique identifier for this File.

name(file)

@spec name(t()) :: {:ok, String.t()} | {:error, term()}

Retrieves the name of the file.

search(file, pattern, optional_args \\ [])

@spec search(t(), String.t(),
  literal: boolean() | nil,
  multiline: boolean() | nil,
  dotall: boolean() | nil,
  insensitive: boolean() | nil,
  skip_ignored: boolean() | nil,
  skip_hidden: boolean() | nil,
  files_only: boolean() | nil,
  limit: integer() | nil,
  paths: [String.t()],
  globs: [String.t()]
) :: {:ok, [Dagger.SearchResult.t()]} | {:error, term()}

Searches for content matching the given regular expression or literal string.

Uses Rust regex syntax; escape literal ., [, ], {, }, | with backslashes.

size(file)

@spec size(t()) :: {:ok, integer()} | {:error, term()}

Retrieves the size of the file, in bytes.

sync(file)

@spec sync(t()) :: {:ok, t()} | {:error, term()}

Force evaluation in the engine.

with_name(file, name)

@spec with_name(t(), String.t()) :: t()

Retrieves this file with its name set to the given name.

with_replaced(file, search, replacement, optional_args \\ [])

@spec with_replaced(t(), String.t(), String.t(),
  all: boolean() | nil,
  first_from: integer() | nil
) ::
  t()

Retrieves the file with content replaced with the given text.

If 'all' is true, all occurrences of the pattern will be replaced.

If 'firstAfter' is specified, only the first match starting at the specified line will be replaced.

If neither are specified, and there are multiple matches for the pattern, this will error.

If there are no matches for the pattern, this will error.

with_timestamps(file, timestamp)

@spec with_timestamps(t(), integer()) :: t()

Retrieves this file with its created/modified timestamps set to the given time.