Dagger NodeJS SDK
api/client.gen.File
A file.
Hierarchy
-
BaseClient
↳
File
Constructors
constructor
new File(parent?
, _id?
, _contents?
, _export?
, _name?
, _size?
, _sync?
): File
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? | FileID |
_contents? | string |
_export? | boolean |
_name? | string |
_size? | number |
_sync? | FileID |
Returns
Overrides
BaseClient.constructor
Properties
_contents
Private
Optional
Readonly
_contents: string
= undefined
_export
Private
Optional
Readonly
_export: boolean
= undefined
_id
Private
Optional
Readonly
_id: FileID
= undefined
_name
Private
Optional
Readonly
_name: string
= undefined
_size
Private
Optional
Readonly
_size: number
= undefined
_sync
Private
Optional
Readonly
_sync: FileID
= undefined
Methods
contents
contents(): Promise
<string
>
Retrieves the contents of the file.
Returns
Promise
<string
>
export
export(path
, opts?
): Promise
<boolean
>
Writes the file to a file path on the host.
Parameters
Name | Type | Description |
---|---|---|
path | string | Location of the written directory (e.g., "output.txt"). |
opts? | FileExportOpts | - |
Returns
Promise
<boolean
>
id
id(): Promise
<FileID
>
A unique identifier for this File.
Returns
Promise
<FileID
>
name
name(): Promise
<string
>
Retrieves the name of the file.
Returns
Promise
<string
>
size
size(): Promise
<number
>
Retrieves the size of the file, in bytes.
Returns
Promise
<number
>
sync
sync(): Promise
<File
>
Force evaluation in the engine.
Returns
Promise
<File
>
with
with(arg
): File
Call the provided function with current File.
This is useful for reusability and readability by not breaking the calling chain.
Parameters
Name | Type |
---|---|
arg | (param : File ) => File |
Returns
withTimestamps
withTimestamps(timestamp
): File
Retrieves this file with its created/modified 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). |