PDF-Archiver/PDF-Archiver

View on GitHub
ArchiveCore/Sources/ArchiveBackend/FolderAccess/FolderProvider.swift

Summary

Maintainability
A
0 mins
Test Coverage
//
//  FolderProvider.swift
//  
//
//  Created by Julian Kahnert on 16.08.20.
//

import Foundation

public protocol FolderProvider: AnyObject, Log {
    typealias FolderChangeHandler = (FolderProvider, [FileChange]) -> Void

    static func canHandle(_ url: URL) -> Bool

    var baseUrl: URL { get }

    init(baseUrl: URL, _ handler: @escaping FolderChangeHandler) throws

    func save(data: Data, at: URL) throws
    func startDownload(of: URL) throws
    func fetch(url: URL) throws -> Data
    func delete(url: URL) throws
    func rename(from: URL, to: URL) throws
    func getCreationDate(of: URL) throws -> Date?
}