Index

RBFilesystem.swift

Classes


RBFilesystem

Filesystem convenience methods.

Functions

Gets the local filesystem path to the given system directory.
@param pathDirectory : The system directory.
@returns The retrieved path.
public class func path(pathDirectory: FileManager.SearchPathDirectory) -> String?

The path to the documents directory.
public class func pathToDocumentsDirectory() -> String

The path to the temporary directory.
public class func pathToTemporaryDirectory() -> String

The path to the bundle directory.
public class func pathToBundleDirectory() -> String

The path to the cache directory.
public class func pathToCacheDirectory() -> String

Retrieves a list of the files at the path given that match the given extension. Excludes directories.
@param path : The path to retrieve the list of files from.
@param includeFullPaths : Whether each item should include the full path, or just the name.
@param extension : Optional extension to match. (Assumes no . (dot))
@returns The Array file list.
public class func files(path: String, includeFullPaths: Bool, extension: String?) -> [String]

Retrieves a list of the directories at the path given.
@param path : The path to retrieve the list of directories from.
@param includeFullPaths : Whether each item should include the full path, or just the name.
@returns The Array directory list.
public class func directories(path: String, includeFullPaths: Bool) -> [String]?

Determines whether or not a file exists at the given path.
@param path : The path to the file.
@returns Whether or not the file exists.
public class func fileExists(path: String) -> Bool

Determines whether or not a directory exists at the given path.
@param path : The path to the directory.
@returns Whether or not the directory exists.
public class func directoryExists(path: String) -> Bool

Creates a directory at the given path.
@param path : The path to create a directory at.
@returns Whether or not the operation was successful.
public class func createDirectory(path: String) -> Bool

Gets the modified date of the item at the given path.
@param path : The path to the item.
@returns The Date result.
public class func modifiedDate(path: String) -> Date?

Removes the file at the given path.
@param path : The path to the file to remove.
@returns Whether or not the operation was successful.
public class func removeFile(path: String) -> Bool

Reads data from the disk asynchronously.
@param queue : The dispatch queue, pass nil to use main dispatch queue.
@param path : The path to the item to read.
@param filterBlock : An optional block to filter the data.
@param completion : The completion block providing the result on completion.
@returns A task handle that can be used to cancel the operation.
public class func readDataOnce(queue: DispatchQueue? = nil, path: String, filterBlock: ((_ data: Data) -> Data)? = nil, completion: ((_ data: Data?, _ error: Error?, _ wasCancelled: Bool) -> Void)? = nil) -> RBCancellableTask