Skip to main content

Work in progress

PrivMX Endpoint Swift is not up to date with the core documentation. Some of the features you've seen described in other parts of the documentation might not be mentioned here. Those changes do not influence compatibility, however

Downloading Files

Downloading file content and accessing files.

Downloading a file from the Store and saving it by chunk (defined by size var) to Data():

var fileId = "FILE_ID"

guard let privMXEndpoint = endpointContainer.getEndpoint(nil) else {return}
if let api = privMXEndpoint.storeApi{
guard let size = try? api.getFile(fileId).size else {return}
guard let handle = try? api.openFile(fileId) else {return}
guard let data = try? api.readFromFile(withHandle: handle,
length: size) else {return}
_ = try? api.closeFile(withHandle: handle)
}