class File extends AbstractObject implements IdAble

A file.

Properties

$lastQuery from  AbstractObject

Methods

__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

null|array|string|int|float|bool
queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

asEnvFile(bool|null $expand = null)

Parse as an env file

asJSON()

Parse the file contents as JSON.

chown(string $owner)

Change the owner of the file recursively.

string
contents(int|null $offsetLines = null, int|null $limitLines = null)

Retrieves the contents of the file.

string
digest(bool|null $excludeMetadata = false)

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.

string
export(string $path, bool|null $allowParentDirPath = false)

Writes the file to a file path on the host.

id()

A unique identifier for this File.

string
name()

Retrieves the name of the file.

array
search(string $pattern, bool|null $literal = false, bool|null $multiline = false, bool|null $dotall = false, bool|null $insensitive = false, bool|null $skipIgnored = false, bool|null $skipHidden = false, bool|null $filesOnly = false, int|null $limit = null, array|null $paths = null, array|null $globs = null)

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

int
size()

Retrieves the size of the file, in bytes.

stat()

Return file status

sync()

Force evaluation in the engine.

withName(string $name)

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

withReplaced(string $search, string $replacement, bool|null $all = false, int|null $firstFrom = null)

Retrieves the file with content replaced with the given text.

withTimestamps(int $timestamp)

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

Details

in AbstractObject at line 13
__construct(AbstractClient $client, QueryBuilderChain $queryBuilderChain)

No description

Parameters

AbstractClient $client
QueryBuilderChain $queryBuilderChain

in AbstractObject at line 19
protected null|array|string|int|float|bool queryLeaf(QueryBuilder $leafQueryBuilder, string $leafKey)

No description

Parameters

QueryBuilder $leafQueryBuilder
string $leafKey

Return Value

null|array|string|int|float|bool

at line 19
EnvFile asEnvFile(bool|null $expand = null)

Parse as an env file

Parameters

bool|null $expand

Return Value

EnvFile

at line 31
JsonValue asJSON()

Parse the file contents as JSON.

Return Value

JsonValue

at line 40
File chown(string $owner)

Change the owner of the file recursively.

Parameters

string $owner

Return Value

File

at line 50
string contents(int|null $offsetLines = null, int|null $limitLines = null)

Retrieves the contents of the file.

Parameters

int|null $offsetLines
int|null $limitLines

Return Value

string

at line 65
string digest(bool|null $excludeMetadata = false)

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.

Parameters

bool|null $excludeMetadata

Return Value

string

at line 77
string export(string $path, bool|null $allowParentDirPath = false)

Writes the file to a file path on the host.

Parameters

string $path
bool|null $allowParentDirPath

Return Value

string

at line 90
AbstractId id()

A unique identifier for this File.

Return Value

AbstractId

at line 99
string name()

Retrieves the name of the file.

Return Value

string

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

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

Parameters

string $pattern
bool|null $literal
bool|null $multiline
bool|null $dotall
bool|null $insensitive
bool|null $skipIgnored
bool|null $skipHidden
bool|null $filesOnly
int|null $limit
array|null $paths
array|null $globs

Return Value

array

at line 161
int size()

Retrieves the size of the file, in bytes.

Return Value

int

at line 170
Stat stat()

Return file status

Return Value

Stat

at line 179
FileId sync()

Force evaluation in the engine.

Return Value

FileId

at line 188
File withName(string $name)

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

Parameters

string $name

Return Value

File

at line 206
File withReplaced(string $search, string $replacement, bool|null $all = false, int|null $firstFrom = null)

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.

Parameters

string $search
string $replacement
bool|null $all
int|null $firstFrom

Return Value

File

at line 227
File withTimestamps(int $timestamp)

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

Parameters

int $timestamp

Return Value

File