Files and directories on Latch can be referred to in code or through the CLI using Latch URLs.
The basic structure of a Latch URL is
latch://, followed by a (possibly empty) Domain, finally ending with an absolute
/-separated path. This is summarized below.
A domain can be in one of several different forms. Each of these domains affect the way that the path following it is resolved.
<ACCOUNT_ID>.account: Resolve the path as if it were a path in the specified account.
<BUCKET_NAME>.mount: Resolve the path as if it were a path in the mounted S3 bucket specified. (Note: the bucket must be mounted to Latch first)
<NODE_ID>.node: Resolve the path as if it were a relative path under the specified node.
shared.<ACCOUNT_ID>.account: Resolve the path as if it were shared in the specified account.
In addition to these, the empty domain (paths that look like
latch:///...) and the domain
shared are both valid. When used, their behavior depends on the workspace that the user is currently in.
latch:///... is treated the same as
latch://shared/... is treated the same as
The path following the domain, if provided, must be an absolute
/-separated path. In
<NODE_ID>.node domains, the path is resolved relative to the node specified. In
<BUCKET_NAME>.mount domains, the path is resolved as if it were an S3 key in the mounted bucket.
A path can be omitted altogether (i.e. a path of the form
latch://<DOMAIN>) if and only if the domain is of the form
Whether or not a path ends with a slash does not affect the file or directory it resolves to. However, it may affect the result of a command that uses it (e.g.
latch:///points to root directory in the user’s current workspace.
latch://71.account/bottomly/genomic.fna/points to the file at
/bottomly/genomic.fnain the account with id
latch://shared/results/summary.csvpoints to the file at
/results/summary.csv, that was shared to the user’s current workspace.
latch://mount-test.mount/11211a11.fastqpoints to the file with key
11211a11.fastqin the S3 bucket
latch://2698497.nodepoints to the node with ID
latch://2698497.node/file.txtpoints to the child of the node with ID