iCloud.docDownload()

Type Function
Return value none
Revision Release 2024.3703
Keywords iCloud, sync, storage, document, docDownload
See also iCloud.docEvict()
iCloudDocEvent
iCloud.*

Overview

iCloud Documents do not necessarily exist on disk and the system may evict them if disk space is needed. To speed up document access, call this function to initiate a download and invoke the onComplete listener function with an iCloudDocEvent.

Gotchas

The onComplete listener function is called when the download is initiated, not when the download completes.

Syntax

iCloud.docDownload( params )
params (required)

Table. Table containing method-specific parameters — see the next section for details.

Parameter Reference

Valid keys for the params table include:

Example

local function docListener( event )

    if event.isError then
        print( event.error )
        print( event.errorCode )
    end
end

iCloud.docDownload(
    {
        filename = "test.txt",
        onComplete = docListener
    }
)