--- title: "download" slug: "network-download" updated: 2025-11-13T18:22:51Z published: 2025-11-13T18:22:51Z canonical: "docs.doc-know.com/network-download" --- > ## Documentation Index > Fetch the complete documentation index at: https://docs.doc-know.com/llms.txt > Use this file to discover all available pages before exploring further. # download ### network.download Initiates an asynchronous download of a specified Internet resource such as a file, raw data, or image. When downloading completes, the results are stored inside the runtime's [cache](http://docs.doc-know.com/v1/docs/cache-intro) object using a provided **key**. The [Ux.ResourceReady](http://docs.doc-know.com/v1/docs/events) event is also triggered so you can take action when your resource becomes available. Downloading resources from an app's [locker](http://docs.doc-know.com/app-locker) is also supported using the resource's **locker token**. This is the recommended approach for downloading resources since they are fully managed by the app. ### Input Parameters | Name | Type | Required | Description | | --- | --- | --- | --- | | **uri** | Text | Yes | Location of Internet resource | | **key** | Text | Yes | Unique [cache](http://docs.doc-know.com/v1/docs/cache-intro) key where item will be stored | | **[type]** | Text | No | Type of data being downloaded | ### Returns Type: **Any** Returns the downloaded Internet resource and attempts to convert it to the type specified. **Text** is the default type. The following types are supported: | Name | Description | | --- | --- | | **text** | Plain text (**default**) | | **json** | JSON object | | **xml** | XML document | | **image** | Platform-specific image object | | **bits** | Raw binary data | ### Examples ``` // inside the Ux.Initialize script... // initiate download of text resource from app's locker using its token network.download("TOKEN", "config"); ``` ``` // inside the Ux.Initialize script... // initiate download of text and json resources from the Internet network.download("https://www.mydomain.com/file.txt", "config"); network.download("https://www.mydomain.com/object.json", "person", "json"); ``` ``` // inside the Ux.ResourceReady script... // note: this script will run once for each downloaded resource // get the cache key for this downloaded resource var key = script.args[0]; // fetch the downloaded resource from cache var item = cache.get(key); ``` ### Remarks Use this function when you need to download external resources from the Internet such as files, raw data, or images. Downloading resources from your app's [locker](http://docs.doc-know.com/app-locker) instead of the open Internet is strongly recommended since they are fully managed by the app. One common scenario is to download a file available on a server using the [Ux.Initialize](http://docs.doc-know.com/v1/docs/events) event. Once downloaded, you can take action using the [Ux.ResourceReady](http://docs.doc-know.com/v1/docs/events) event. The [cache](http://docs.doc-know.com/v1/docs/cache-intro) **key** you provided is accessible via the runtime's [script](http://docs.doc-know.com/v1/docs/script-intro2) object. Two-Step Process Downloading resources from the Internet can be slow based on connection speeds and the size of the resources being downloaded. Because of this speed issue, downloading Internet resources requires a two-step process. First, you must initiate the download (from one script). Second, you take action (if needed) after the download completes from another script (i.e. [Ux.ResourceReady](http://docs.doc-know.com/v1/docs/events)). By separating these steps, the user's experience remains fluid. Otherwise, the user interface would freeze until the download completes, which is a poor user experience.