FileSystemObjectMonitor

public class FileSystemObjectMonitor : BaseMonitor

A FileSystemObjectMonitor instance monitors a file-system object for changes. A file-system object can be a regular file, a directory, a symbolic link, a socket, a pipe, or a device. Monitorable activities can include when the file-system object is deleted, written to, or renamed, as well as when specific types of meta information (such as its size and link count) change.

  • Encapsulates changes to the file-system object.

    See more

    Declaration

    Swift

    public enum Event
  • Specifies which events to monitor.

    See more

    Declaration

    Swift

    public struct Options : OptionSet
  • Initializes a new FileSystemObjectMonitor.

    Declaration

    Swift

    public init(fileURL: URL,
                options: Options = .all,
                queue: OperationQueue = .main,
                handler: @escaping (Event) -> Void)

    Parameters

    fileURL

    The URL of the file-system object to monitor.

    options

    The options that specify which events to monitor. By default, all events are monitored.

    queue

    The operation queue on which the handler executes. By default, the main operation queue is used.

    handler

    The handler to call when the file-system object changes.

  • The URL of the file-system object being monitored. If the file-system object is renamed in the namespace (and wasRenamed events are being monitored), this URL is updated accordingly.

    Declaration

    Swift

    public private(set) var fileURL: URL
  • Declaration

    Swift

    override public func cleanupMonitor()
  • Declaration

    Swift

    override public func configureMonitor()