Skip to main content
reference

PrivMXStoreFileHandler

A class providing a set of tools using SwiftNIO for uploading and downloading files with the use of PrivMXStore from PrivMX Endpoint.

Fields

RecommendedChunkSize

Recommended chunk size for file transfers, suggested by the endpoint library.

public static let RecommendedChunkSize :Int64 = 131072

mode

public let mode:StoreFileHandlerMode

hasDataLeft

public var hasDataLeft:Bool = true

Methods

getBuffer()

Provides access to the data buffer of the processed file.

public func getBuffer(
) -> Data?

TypeDescription
Data? The processed data buffer.

close()

Closes both local and remote files.

public func close(
) throws -> String

TypeDescription
String A string representing the result of closing the remote file.

readChunk(onChunkDownloaded:)

Downloads the next chunk and adds it to either the local file or the internal buffer, depending on the mode.

public func readChunk(
onChunkDownloaded: @escaping ((Int)->Void) = {byteCount in}
) throws -> Void

NameTypeDescription
onChunkDownloaded@escaping ((Int) -> Void)A closure called when a chunk is downloaded, passing the byte count of the chunk.

writeChunk(onChunkUploaded:)

Uploads the next chunk of data from the local file or buffer to the remote file.

public func writeChunk(
onChunkUploaded: @escaping ((Int) -> Void) = {byteCount in}
) throws -> Void

NameTypeDescription
onChunkUploaded@escaping ((Int) -> Void)A closure called when a chunk is uploaded, passing the byte count of the chunk.