FileSystem

@objc(VSSFileSystem)
open class FileSystem : NSObject

Class for saving data to the filesystem

Note

This class is NOT thread-safe
  • Tag: FileSystem
  • File Manager

    Declaration

    Swift

    @objc
    public let fileManager: FileManager
  • Undocumented

    Declaration

    Swift

    @objc
    public let appGroup: String?
  • Prefix

    Declaration

    Swift

    @objc
    public let prefix: String
  • User identifier (identity)

    Declaration

    Swift

    @objc
    public let userIdentifier: String
  • Path components

    Declaration

    Swift

    @objc
    public let pathComponents: [String]
  • Encryption credentials

    Declaration

    Swift

    @objc
    public let credentials: FileSystemCredentials?
  • Init

    Declaration

    Swift

    @objc
    public init(appGroup: String? = nil,
                prefix: String,
                userIdentifier: String,
                pathComponents: [String],
                credentials: FileSystemCredentials? = nil)

    Parameters

    appGroup

    appGroup

    prefix

    prefix

    userIdentifier

    user identifier

    pathComponents

    path components

    credentials

    encryption credentials

Public API

  • Returns full url of file with given name and subdirectory

    Declaration

    Swift

    @objc
    func getFullUrl(name: String?, subdir: String?) throws -> URL

    Parameters

    name

    file name

    subdir

    subdirectory

  • Write data

    Throws

    Rethrows from FileManager

    Declaration

    Swift

    @objc
    func write(data: Data, name: String, subdir: String? = nil) throws

    Parameters

    data

    data to write

    name

    file name

    subdir

    subdirectory

  • Read data

    Throws

    Rethrows from FileManager

    Declaration

    Swift

    @objc
    func read(name: String, subdir: String? = nil) throws -> Data

    Parameters

    name

    file name

    subdir

    subdirectory

    Return Value

    Data

  • Returns file names in given subdirectoty

    Throws

    Rethrows from FileManager

    Declaration

    Swift

    @objc
    func getFileNames(subdir: String? = nil) throws -> [String]

    Parameters

    subdir

    subdirectory

    Return Value

    File names

  • Delete data

    Throws

    Rethrows from FileManager

    Declaration

    Swift

    @objc
    func delete(name: String, subdir: String? = nil) throws

    Parameters

    name

    file name

    subdir

    subdirectory

  • Delete directory

    Throws

    Rethrows from FileManager

    Declaration

    Swift

    @objc
    func delete(subdir: String? = nil) throws

    Parameters

    subdir

    subdirectory