TypeScript SDK Reference
api/client.gen.Directory
A directory.
Hierarchy
-
BaseClient
↳
Directory
Constructors
constructor
new Directory(parent?
, _id?
, _digest?
, _export?
, _sync?
): Directory
Constructor is used for internal usage only, do not create object from it.
Parameters
Name | Type |
---|---|
parent? | Object |
parent.ctx | Context |
parent.queryTree? | QueryTree [] |
_id? | DirectoryID |
_digest? | string |
_export? | string |
_sync? | DirectoryID |
Returns
Overrides
BaseClient.constructor
Properties
_digest
Private
Optional
Readonly
_digest: string
= undefined
_export
Private
Optional
Readonly
_export: string
= undefined
_id
Private
Optional
Readonly
_id: DirectoryID
= undefined
_sync
Private
Optional
Readonly
_sync: DirectoryID
= undefined
Methods
asModule
asModule(opts?
): Module_
Load the directory as a Dagger module
Parameters
Name | Type |
---|---|
opts? | DirectoryAsModuleOpts |
Returns
diff
diff(other
): Directory
Gets the difference between this directory and an another directory.
Parameters
Name | Type | Description |
---|---|---|
other | Directory | Identifier of the directory to compare. |
Returns
digest
digest(): Promise
<string
>
Return the directory'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.
Returns
Promise
<string
>
directory
directory(path
): Directory
Retrieves a directory at the given path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the directory to retrieve (e.g., "/src"). |
Returns
dockerBuild
dockerBuild(opts?
): Container
Builds a new Docker container from this directory.
Parameters
Name | Type |
---|---|
opts? | DirectoryDockerBuildOpts |
Returns
entries
entries(opts?
): Promise
<string
[]>
Returns a list of files and directories at the given path.
Parameters
Name | Type |
---|---|
opts? | DirectoryEntriesOpts |
Returns
Promise
<string
[]>
export
export(path
, opts?
): Promise
<string
>
Writes the contents of the directory to a path on the host.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the copied directory (e.g., "logs/"). |
opts? | DirectoryExportOpts | - |
Returns
Promise
<string
>
file
file(path
): File
Retrieves a file at the given path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the file to retrieve (e.g., "README.md"). |
Returns
glob
glob(pattern
): Promise
<string
[]>
Returns a list of files and directories that matche the given pattern.
Parameters
Name | Type | Description |
---|---|---|
pattern | string | Pattern to match (e.g., "*.md"). |
Returns
Promise
<string
[]>
id
id(): Promise
<DirectoryID
>
A unique identifier for this Directory.
Returns
Promise
<DirectoryID
>
sync
sync(): Promise
<Directory
>
Force evaluation in the engine.
Returns
Promise
<Directory
>
terminal
terminal(opts?
): Directory
Opens an interactive terminal in new container with this directory mounted inside.
Parameters
Name | Type |
---|---|
opts? | DirectoryTerminalOpts |
Returns
with
with(arg
): Directory
Call the provided function with current Directory.
This is useful for reusability and readability by not breaking the calling chain.
Parameters
Name | Type |
---|---|
arg | (param : Directory ) => Directory |
Returns
withDirectory
withDirectory(path
, directory
, opts?
): Directory
Retrieves this directory plus a directory written at the given path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the written directory (e.g., "/src/"). |
directory | Directory | Identifier of the directory to copy. |
opts? | DirectoryWithDirectoryOpts | - |
Returns
withFile
withFile(path
, source
, opts?
): Directory
Retrieves this directory plus the contents of the given file copied to the given path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the copied file (e.g., "/file.txt"). |
source | File | Identifier of the file to copy. |
opts? | DirectoryWithFileOpts | - |
Returns
withFiles
withFiles(path
, sources
, opts?
): Directory
Retrieves this directory plus the contents of the given files copied to the given path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location where copied files should be placed (e.g., "/src"). |
sources | File [] | Identifiers of the files to copy. |
opts? | DirectoryWithFilesOpts | - |
Returns
withNewDirectory
withNewDirectory(path
, opts?
): Directory
Retrieves this directory plus a new directory created at the given path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the directory created (e.g., "/logs"). |
opts? | DirectoryWithNewDirectoryOpts | - |
Returns
withNewFile
withNewFile(path
, contents
, opts?
): Directory
Retrieves this directory plus a new file written at the given path.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the written file (e.g., "/file.txt"). |
contents | string | Content of the written file (e.g., "Hello world!"). |
opts? | DirectoryWithNewFileOpts | - |
Returns
withTimestamps
withTimestamps(timestamp
): Directory
Retrieves this directory with all file/dir timestamps set to the given time.
Parameters
Name | Type | Description |
---|---|---|
timestamp | number | Timestamp to set dir/files in. Formatted in seconds following Unix epoch (e.g., 1672531199). |
Returns
withoutDirectory
withoutDirectory(path
): Directory
Retrieves this directory with the directory at the given path removed.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the directory to remove (e.g., ".github/"). |
Returns
withoutFile
withoutFile(path
): Directory
Retrieves this directory with the file at the given path removed.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the file to remove (e.g., "/file.txt"). |
Returns
withoutFiles
withoutFiles(paths
): Directory
Retrieves this directory with the files at the given paths removed.
Parameters
Name | Type | Description |
---|---|---|
paths | string [] | Location of the file to remove (e.g., ["/file.txt"]). |