The Latch SDK provides a convenient means of referencing files or directories hosted on Latch within task functions.Documentation Index
Fetch the complete documentation index at: https://wiki.latch.bio/llms.txt
Use this file to discover all available pages before exploring further.
Downloading Files
To download files locally:Caching File Downloads
By default, thedownload method will not cache the file. To enable caching, pass cache=True.
If you do not provide a local destination path, the file will be downloaded to the default
~/.latch/ directory. Without caching enabled, this can result in multiple downloads of the same file, unnecessarily increasing storage usage. To avoid this, it is strongly recommended to set a destination path and enable caching, especially when using LPath in Latch Pods or Latch Plots.Uploading Files
To upload files from a local path to a Latch path:To upload to a remote path, the parent directory of the
remote path must already exist. To ensure that the parent directory
exists, use
LPath("latch:///parent_directory").mkdirp().Copying Between Latch Paths
Copy data from one Latch path to another:Deleting Latch Files
Recursively remove a remote file or directory:Fetching File Metadata
Use the following methods to fetch metadata of your remote files without downloading the file first:node_id()name()content_type()size()
LPath method is invoked. To re-populate the cache, use the
LPath().fetch_metadata() method. For example: