FileOperationProvider

public protocol FileOperationProvider

Abstract layer of core features for working with local files.

  • Local file directory manager supported by the system

    Declaration

    Swift

    associatedtype DirectoryManager : FileDirectoryOperationProvider
  • Undocumented

    Declaration

    Swift

    var directoryManager: DirectoryManager { get }
  • Create FileOperationProvider with provided DirectoryManager

    Declaration

    Swift

    init(directoryManager: DirectoryManager)
  • save(contentsOf:with:) Default implementation

    Saaved given file data in local file sytem

    Throws

    Throws:

    • When data is not valid (nil or empty)

    Default Implementation

    Declaration

    Swift

    func save(contentsOf data: Data?, with name: String) throws -> FileItem

    Parameters

    contentsOf

    data object, that needs to be saved

    with

    Name used for saving data as file

    Return Value

    Saved FileItem

  • getFile(at:) Default implementation

    Fetches the file at given location

    Throws

    Throws:

    • When file is not found
    • When file is not accessible
    • When provided url is not a file location

    Default Implementation

    Declaration

    Swift

    func getFile(at location: URL) throws -> FileItem

    Parameters

    at

    Location, used for fetching the file

    Return Value

    Fetched FileItem

  • deleteFile(at:) Default implementation

    Deletes the file at given location

    Throws

    Throws:

    • When file is not found
    • When file is not accessible
    • When provided url is not a file location

    Default Implementation

    Declaration

    Swift

    func deleteFile(at location: URL) throws

    Parameters

    at

    Location, used for deleting the file

    Return Value

    Fetched FileItem