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?
Type | Description |
---|---|
Data? | The processed data buffer. |
close()
Closes both local and remote files.
public func close(
) throws -> String
Type | Description |
---|---|
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
Name | Type | Description |
---|---|---|
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
Name | Type | Description |
---|---|---|
onChunkUploaded | @escaping ((Int) -> Void) | A closure called when a chunk is uploaded, passing the byte count of the chunk. |