tiled.client.cache.download

tiled.client.cache.download(*entries)[source]

Download a local cache for Tiled so access is fast and can work offline.

Parameters:
*entriesNode(s) or structure client(s)

Examples

Connect a tree and download it in its entirety.

>>> from tiled.client import from_uri
>>> from tiled.client.cache import download, Cache
>>> client = from_uri("http://...", cache=Cache.on_disk("path/to/directory"))
>>> download(client)

Alternatively ,this can be done from the commandline via the tiled CLI:

$ tiled download “http://…” my_cache_direcotry

Use the local copy for faster data access. Tiled will connect to server just to verify that the local copy is current, and only download data if there have been changes to the copy of the server.

>>> from tiled.client import from_uri
>>> from tiled.client.cache import Cache
>>> client = from_uri("http://...")
>>> client = from_uri("http://...", cache=Cache.on_disk("my_cache_directory"))

If network is unavailable or very slow, rely on the local copy entirely. Tiled will not connect to the server. (Note that you still need to provide a URL, but it is only used to contruct the names of files in the local directory.)

>>> from tiled.client import from_uri
>>> from tiled.client.cache import Cache
>>> client = from_uri("http://...", cache=Cache.on_disk("my_cache_directory"), offline=True)